No announcement yet.

register a touch event

  • Filter
  • Time
  • Show
Clear All
new posts

  • register a touch event

    Hopefully a simple answer awaits.

    I would like to put my display to sleep after a specific amount of time after the last recorded touch on the screen.

    So when a touch is recorded, the sleep timer restarts.

    Is it possible inside the Genie Event handler to recognize a touch event?

  • #2
    well if a user touched a widget that reports then yes, once the event is collected you could issue a reset to a millis() counter and check the routine in your loop if that counter exceeded your sleep setting, if so, goto sleep. basically have all events generate a millis() counter reset, no need to be specific, you can reset your counter from top of the handler function without any conditions needed



    • #3
      Hi Craig,

      The Genie Event Handler recognizes touch events in the widgets displayed. By getting the Report Event of the touched widgets, you may reset the counter and have your display in active mode. However, sleep function is not included in the genie library but you can still run the program the way you like by using the genie.WriteContrast(value) function with values ranging from 0 to 15. Setting the value to zero will turn off the screen while a non-zero value turns it on. The “” executes this set up.

      If you wish to proceed using the Sleep function in the Visi-Genie environment, you will have to use the Genie Magic. Using the WinButton Report Message, you may detect the last touch on the screen then send a report to the host which will start the counter. The conditions for the sys_Sleep(value) function is included in the Magic Object code. You may check the “” to run this set up.

      To open a ViSi-Genie project with magic code objects, please start your WS4 PRO trial period by going to File > Options > License, then click on the "Start Pro Trial" button.

      Hope this helps.
      Attached Files


      • #4
        Hey Guys,

        Thanks for the reply. I was previously using Write.Contrast to basically "turn off" the screen and it works well.

        The issue is I was using another Read.Object in another automatic routine which was throwing off my timer (duh).

        It's all good now.

        Thanks again!



        • #5
          Hi, Craig!

          No worries. Don't hesitate to visit the forum again if you have questions.

          Best Regards,