No announcement yet.

Touch event

  • Filter
  • Time
  • Show
Clear All
new posts

  • Touch event

    Hi everyone!
    I`m working with mLCD-32PTU, and project on which i`m working on, as far as i understand, is writen on Picaso Serial Enviroment. Screen detects touching by function touch_Get every 250 msec. One thing that is annoying me so much is that when screen is busy (PC transfers image and so on) i can`t control the screen.

    Is it posible to detect screen touch by some event? So that when somebody touches the screen some on_touch event is added to queue?

    Sorry for such a noob question, but tell me please if it is posible to do with Picaso Serial Enviroment?


  • #2

    No there is no event, you can only poll it.

    Why the "Screen detects touching by function touch_Get every 250 msec"? surely it would be better to stay in a loop sending touch_Get continuously (Windows wont look as though the app is looping as it will be doing 'lots of' other things whilst waiting for the comms port).

    If Windows is that sluggish it wouldn't be able to respond to events either.

    It would be nice to understand the issue better, but the above might be all that's needed to fix it.


    • #3

      Thank you for reply!

      I`m not very good in english, and i`m not sure i understood the following: "Windows wont look as though the app is looping as it will be doing 'lots of' other things whilst waiting for the comms port". Could you rephrase it?

      The issue is: the screen must show different pictures downloaded fom internet every second. During the writing it doesn`t respont to enything, and i want it to respond on my touches at least when it is free. Now instead of 1 touch and waiting i have to do lot of touches untill it responds.

      Today i`ll try the continuous touch_Get, and will reply if it worked.

      Anyway, how much time will i have to spend if i want to add touch events to my project?

      Thank you!


      • #4

        "Windows wont look as though the app is looping as it will be doing 'lots of' other things whilst waiting for the comms port"
        I was thinking you had a 250ms delay between checks for touch according to what you said. I though you may have been doing that to stop your Windows app from looking like it was looping. I now see, think that is not what you are doing so don't worry about it.

        If you touch and hold, there very next touch get will report a touch, even if it is 250ms since the touch occurred, so you don't need to touch repeatedly to get 'touch get' to detect the touch, touch and hold will do.

        You say "must show different pictures downloaded fom internet every second" yet at 200kbaud in will take around 7.7 seconds to transfer a full screen image.

        Are you doing lots of smaller images and/or partial images so you can add 'touch gets' in between them?

        If not, that is something you can try, eg send top left quarter, 'touch get', send top right quarter, 'touch get', etc.

        You could also do something similar in a function where the function receives the screen over serial and sends the touch status back to the host at periodic intervals. Of course this would require an understanding of 4DGL to implement.


        • #5

          Thank you for reply!

          Yes, i have 4 pictures, refresh them one by one with get_touch between them.
          Dividing heavy tasks to parts with get_touch between them is great idea, thank you!

          One my question is not answered, "how difficult is it to add touch events to my project?"


          • #6

            Well you can't really. The system works on a polled method.

            There are no true events available in the system.

            And a 'polled event' just wouldn't work as you'd have no way of determining the 'currency' of the poll.


            • darthhamos
              darthhamos commented
              Editing a comment
              Mark, would you also be so kind as to link the documentation on the function <touch_Get()>? I realize this is kindof a noob question, but where is the documentation of included functions, such as the one mentioned in this thread?

              I found this document---written for ViSi project---can I use the same <touch> functions as shown in this PDF (see page 40) for ANY Workshop4 project involving a touch-sensitive display?
              Last edited by darthhamos; 3rd August 2017, 11:52 PM.

          • #7
            The functions you are after are in the 'Internal functions manual'.

            You can wind them for download from the Workshop product page "Designer Environment Documentation", but you already have them.

            Workshop maintains the latest manuals in C:\Users\Public\Documents\4D Labs\4DUpdates\Manuals, but again, you don't have to navigate your way there.

            When editing 'code' in Workshop press F1, it will open the correct Internal Functions manual for you (Yes there are three, one for each of the different processors).

            If the cursor is positioned on a function it will go straight to that page.