MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Touch input examples for MM Module

    Scheduled Pinned Locked Moved Development
    18 Posts 5 Posters 4.7k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jcleary05
      last edited by

      Hi Guys

      I am currently in the process of building a module for my dissertation project in university. The module which I will be building will require touch input to complete a questionaire and push the answers of the questionaire to a database.

      Could anyone point me towards some modules which utilise touch input and/or push information to a database?

      Thanks

      S lavolp3L 2 Replies Last reply Reply Quote 0
      • S Offline
        sdetweil @jcleary05
        last edited by sdetweil

        @jcleary05 so, first you have to put MM on a system with a touch screen…

        after than your module would create a small html ‘page’ with a normal html form in it,
        and use the exact same techniques as any javascript driven page…

        you add am event Handler to the button on the form, and then use the document. xxx methods to extract the field data

        https://stackoverflow.com/questions/11563638/how-do-i-get-the-value-of-text-input-field-using-javascript

        push info to database… what database? in Mongodb adding a record looks like
        db.collection(collection_name).insertOne(jsondata, function(err,result){ })

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 1
        • lavolp3L Offline
          lavolp3 Module Developer @jcleary05
          last edited by

          @jcleary05 For touch input, have a look at these:

          https://github.com/werthdavid/MMM-Bring

          https://github.com/lavolp3/MMM-Keyboard (not ready yet, but soon!)
          https://github.com/lavolp3/MMM-NavigationBar

          As you see I’m working extensively on a “touch MM” as a kitchen hub.

          Regarding a database, I can’t help you

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

          J 2 Replies Last reply Reply Quote 1
          • J Offline
            jcleary05
            last edited by

            @sdetweil Thanks for getting back to me!

            The database will most likely be based of mySQL using phpMyAdmin (The university provides this)

            Im unsure how I would actually gain access to this database and submit to it using the current setup of modules. Could this potentially be done using node js?

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @jcleary05
              last edited by

              @jcleary05 mysql, yes , see the node library https://www.npmjs.com/package/mysql, which gives you node methods to call to connect and access the database

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 1
              • J Offline
                jcleary05
                last edited by

                @sdetweil
                Thanks again for getting back to me!

                Do you believe it will be possible for me to submit an entry to a database using the nodehelper.js file?

                I am currently trying to find an example but I am unsure of any which are available?

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @jcleary05
                  last edited by sdetweil

                  @jcleary05 sure… I use mongodb, and connect to it via the node helper

                  here is a web page that describes all the operations (connect, search/get/select,
                  update,

                  https://www.w3schools.com/nodejs/nodejs_mysql.asp

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 1
                  • J Offline
                    jcleary05 @lavolp3
                    last edited by

                    @lavolp3 Sorry man just seeing your message now,
                    Thank you! this will be extremely helpful!

                    S 2 Replies Last reply Reply Quote 0
                    • S Offline
                      sdetweil @jcleary05
                      last edited by sdetweil

                      @jcleary05 sorry, forgot to paste in the url

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 1
                      • J Offline
                        jcleary05 @lavolp3
                        last edited by

                        @lavolp3

                        Just reviewing your modules, they look great! in particular I may have a use case for the keyboard, do you have an estimation when it will be ready to use?

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          sdetweil @jcleary05
                          last edited by

                          @jcleary05 also see https://forum.magicmirror.builders/topic/8734/mmm-mysqlquery-module-just-released

                          for connection and query…

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            jcleary05
                            last edited by sdetweil

                            Also guys, when creating the initial content of the module, will it have to be built using the document objet model or will I be able to bring in a HTML page and edit it using the DOM? Unsure of where to kick of from

                            you can use the element.innerHTML value to inject a raw html text block into that element

                            S 1 Reply Last reply Reply Quote 0
                            • S Offline
                              sdetweil @jcleary05
                              last edited by

                              @jcleary05 the module is contributing a small section of html, ONLY its content… the overall page is managed by MM…

                              the getDom() method returns the small dom tree to inject into the page… in the position element of the page…

                              see my sample module https://github.com/sdetweil/SampleModule

                              if u look at ~/MagicMirror/index.html, you will see the page layout

                              each module is placed into one of those regions.

                              if you use the developers window (ctrl-shift-i) and select the elements tab. you can see the modules output in place

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              1 Reply Last reply Reply Quote 1
                              • D Offline
                                delrein
                                last edited by

                                This post is deleted!
                                1 Reply Last reply Reply Quote 0
                                • J Offline
                                  jcleary05
                                  last edited by

                                  @sdetweil
                                  Thanks for all your help so far!
                                  I am currently trying to build a step by step form, which the user will interact with to answer a number of questions.
                                  Would it be possible to run each element of this form as separate functions called by the getDom function?

                                  Also, to make things easier, would it be possible to call in a piece of html into the js file to work with, instead of having to build the entire form using the createElement functions?

                                  The example I am currently trying to build is similar to this:
                                  https://www.w3schools.com/howto/howto_js_form_steps.asp

                                  S 2 Replies Last reply Reply Quote 0
                                  • S Offline
                                    sdetweil @jcleary05
                                    last edited by

                                    @jcleary05 sure, u can add a text html string into the innerHTML of an element like a div

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      sdetweil @jcleary05
                                      last edited by

                                      @jcleary05 run each button press as separate. Sure.

                                      They don’t have to be online in getDom(). They just have to be linked to the button onClick

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        dvbit
                                        last edited by

                                        Some future direction and option

                                        https://github.com/dvbit/Kinect-Mouse-Swipe-C-Module

                                        Not touch but gestures

                                        1 Reply Last reply Reply Quote 0

                                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                        With your input, this post could be even better 💗

                                        Register Login
                                        • 1 / 1
                                        • First post
                                          Last post
                                        Enjoying MagicMirror? Please consider a donation!
                                        MagicMirror created by Michael Teeuw.
                                        Forum managed by Sam, technical setup by Karsten.
                                        This forum is using NodeBB as its core | Contributors
                                        Contact | Privacy Policy