I am trying to coalesce certain things, where values may be adjusted from various methods and events. What I’d like to do is to have this code called at the end of the current run loop. Is this possible with Xojo?
You can use a private bool for vakuesAreAdjusted with a default value to false and define the setter like this :
-
Create property vakuesAreAdjusted
-
Right click and create computed property
-
In the setter adjust code something like this
mvakuesAreAdjusted = value
if mvakuesAreAdjusted = True then
// Do Something
End if
See this blog post for more information:
https://blog.xojo.com/2016/05/25/methods-overloading-computed-properties-setters-and-getters.
Create a method checkValue and call it each control value change sub
This method have the responsibility to check if all value are set and in this case set vakuesAreAdjusted to true
For Ex:
if (control1.value > "") and (cobntro2.value > "") Then
vakuesAreAdjusted = true
End If
Hey Sebastien,
I am sorry for I didn’t explain what I am trying to do very well. I also think my usage of the term “Run loop” didn’t help, perhaps “Event Loop” would.
If I use a timer, even with a period or 1, this causes a window update with the controls at the wrong location, so it needs to be done before the window is drawn to the screen buffer. The changes can come from many places, so relying on an object destructor (which is what it current does) can fail.
I wonder if I can tap into the macOS memory management system and utilize auto release…
Can’t you start a timer with 0ms period to run when current loop ends?