No announcement yet.

Script Touch variables

  • Filter
  • Time
  • Show
Clear All
new posts

  • Script Touch variables


    I am trying to create a script that displays some buttons in the UP state, waits for a button press, and then displays the button PRESSED until it is released, then displays the Button UP, and then exits.

    The reason for doing this inside the script file, is that I don't want the microcontroller to have to handle the display button push DOWN & UP, but have a script handle it and when it's done, it quits and the micro can then query the coord and decide which button was pressed.

    So I need to detect which button was pressed so that I can display it's DOWN button, however I don't seem to be able to get the touch coord in the script:


    if X > 10 and X < 50 and Y > 10 and Y < 20 then
    ' It was button A that was pressed

  • #2

    I now believe this can't be done in serial mode.


    • #3

      That's correct.

      Why are you concerned about the micro looking after it?

      That's the way most people do it


      • #4


        Well because the micro is busy doing lots of other REAL-TIME stuff, it will only check with the display when it is free, which is maybe once a second, and 1 second is a long time to wait for a button that you pressed to change state.

        The micro is really only interested in what button was pressed, and the fewer display-related tasks it has to handle the better.

        What I had hoped for was to create an autoexec.4ds file that would generate the main screen, by loading graphic images, and drawing text etc, and then wait for a screen touch, at which point it would toggle the button and quit, allowing the micro to then determine the coord of the button that was pressed, and call the autoexec.4ds button to wait for the next touch event.

        it's a shame that it can't be done. as by using the display to handle the button states and then exit would work great, I have tested the rest of the logic and after the script quits, the serial port is freed and I can get the last touch cord.


        • #5

          Yeah, well, there's no real variables in SGC, you could do it in GFX, of course.

          Also probably with a few things we have in the pipeline, but anyway, doesn't really help you