| |
| Publicado el 27,enero 2018 - 17:33 |
| I know I can do this using a timer, but is there any way to detect a global variable value change and then run a procedure. Sort of the equivalent of putting this on a timer running every 1/000th of a second. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,enero 2018 - 19:05 |
Hi John
AFAIK, this is possible ONLY in the debugger, but not by code.
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,enero 2018 - 20:53 |
| Thx that is what i suspected. I could run an infinite procedure on a other thread but not sure what impact that would be on performance it that was timed at say every second. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,enero 2018 - 21:49 |
Hello John
You have asked if a thing is possible, without describing the circumstances that led to the question being asked.
Without any other information, the most obvious answer is to have the process responsible for changing the variable value to also run the other procedure, but I suspect that is not the case here.
Why you want to know when a global variable changes ?
Regards Al |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,enero 2018 - 22:56 |
| Actually I want to constantly check if the app has internet access. If the device loses connection I need to do something.. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2018 - 05:37 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2018 - 09:47 |
Thx that is what I use. But how do you get it to detect when the change takes place exactly? That is why I thought I needed this run on a timer and hence my concern. As it's critical I know just about the exact time the connection is lost I would have to set the time to every half second at the most.
What am I missing? Thx. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2018 - 11:25 |
Hi John,
instead of setting the value of a global variable, you could make a class in which you define a property with a setter.
When the value of the property is set, the setter procedure is run in which you can do whatever you want.
Regards, Bart |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2018 - 11:34 |
| I'm not quite sure I follow. Do you have any example? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2018 - 14:16 |
Hi again
1. a test every second in a timer would have NO impact on general performance
2. Depending on the type of project you are working on, there is a SECOND syntax of internetconnected where a procedure that you code is called each time the answer to the function changes (exactly what you want, but only in some enivronments)... as you are NOT giving us the details, it may or may not concern you
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2018 - 15:00 |
Thanks Fabrice. I did not notice the Procedure option so will check that out. Otherwise a Timer will do.
I am developing for Windows, Android and iOS (Tablet and Phone) so will see what's supported.
Thx. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2018 - 15:47 |
Hi John,
Perhaps I am missing something, but do you need to know if a connection is available all the time? I would do a check before I need to connect instead.
Kind regards, Piet |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2018 - 16:07 |
| Thx but I have my reasons. |
| |
| |
| | | |
|
| | |