Author Topic: Reload touch Screen after 20 Seconds  (Read 3309 times)

peadard

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Mseries
Reload touch Screen after 20 Seconds
« on: September 09, 2013, 05:25:03 pm »
Hi Guys.
I have a touch screen that contains numerous PagedLists. These pagedlists are populated on "Control Loaded" by querying a SQL database.
This works well but was wondering how to refresh the values every 20 seconds.
The way I figured was to reload the touch screen every 20 seconds.
Any ideas how I could do this??
Thanks Guys.

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Reload touch Screen after 20 Seconds
« Reply #1 on: September 11, 2013, 08:05:47 am »
Hello peadard,
I haven't tested any of these, but here are some ideas that may get you going in the right direction.
1.) Does the touchscreen 'refresh' method reload the control?
2.) If above doesn't work you can try the touch screen load method. The script for that is TouchScreen.LoadTouchScreen("touchScreenPath");
3.) If the above doesn't work you can try the top touch screen load method. That script is: TopTouchScreen.LoadTouchScreen("touchScreenPath");

A few other ideas / suggestions:
Move the pagedlist code out of control loaded and into custom event. That way it can be triggered without a reload. As far triggering the custom event you could setup a rule to run every minute (the Scheduled Intervals event doesn't have 'seconds' as an option). Then update a global variable in the action list of the rule. Then at the touch screen level check for the variable change and when it does run the pagedlist custom event. I imagine the easiest way is to add a label to the touch screen and set its text to the global variable. Then on the label's text changed event put the pagedlist custom event. Feels clunky but should work.
I always wanted to be somebody. In retrospect, I think I should have been more specific.

peadard

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Mseries
Re: Reload touch Screen after 20 Seconds
« Reply #2 on: September 15, 2013, 06:55:10 pm »
Hi iostream212.
Thanks for your reply.
The refresh method does not refresh teh control so I have abandoned that method.
Your other suggestions sound like teh way to go however I am having some issues with it.
I have setup a label with the text linked to the value of a Global variable but it does not seem to update itself i.e text change.
When I refresh the screen the text does change so I know that the rule to update the Global variable at a defined interval is working.
As far as I know there is no setting for screen refresh interval. Also I am using Touch Screen viewer on a Desktop to view the label.
Strange...

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Reload touch Screen after 20 Seconds
« Reply #3 on: September 15, 2013, 09:08:14 pm »
Hello P, I did a test with the text change property of a label and it did work, but was not instant.  I think the issue is that a global variable update is not instant like other bound controls, so I was getting delays by approximately 1 minute.  That said, the 1 minute delay seemed to be consistent so maybe setting up several (3) times rules set to repeat every 1 minute 20 seconds apart can get you that 20 second refresh desired in the OP.

Sent from my SCH-I545 using Tapatalk 4

I always wanted to be somebody. In retrospect, I think I should have been more specific.

peadard

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Mseries
Re: Reload touch Screen after 20 Seconds
« Reply #4 on: September 15, 2013, 09:18:28 pm »
Thanks buddy.
I will re-do the rules and set the update interval to mabye 2 minutes and see how I go.
I will let you know.
P

peadard

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Mseries
Re: Reload touch Screen after 20 Seconds
« Reply #5 on: September 18, 2013, 04:11:38 pm »
Ok, managed to get it working.
to do so..
I created a rule based on the device Date and Time and Every # of minutes.
     Whenever Days of Week SMTWTFSS and Minutes 2
     run this script
Code: [Select]
if ( vars.GetVariableValue(@"Reload") == @"Wait" )
{
vars.SetVariableValue(@"Reload", @"Now");
}
else
{
vars.SetVariableValue(@"Reload", @"Wait");
}

This basically every two minutes changes the value of the Global Variable named "Reload" from "Wait" to "Now"
Then I careated a label in the Touchscreen that has its Text linked to the value of the Variable.
Under the Event Actions "Display Text Changed" there is an action to Trigger Custom Event1 in the  necessary PagedList.
So far so good, It seems to be working (desktop Version at least, I havent tried it on the ipad).
Thanks for your help iostream212..
« Last Edit: September 18, 2013, 04:24:31 pm by peadard »

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Reload touch Screen after 20 Seconds
« Reply #6 on: September 19, 2013, 07:42:36 am »
Great to hear! Glad you got it working mate. Thanks for sharing.

Sent from my SCH-I545 using Tapatalk 4

I always wanted to be somebody. In retrospect, I think I should have been more specific.