example
a property in a class is changed
raise a event will update the ui by code
if the ui was changed inside of this event the property in the class get a update
it result in a circular flow.
how do you handle this?
skip events with help of flags or subclass ui elements?
The standard solution is to have a boolean. Something like “isChangingData”. You set that to true at the beginning of what you want to do. The control then has
if isChangingData then return
in the TextChanged or whatever event. At the end of processing you set the boolean to false.
[quote=480860:@Beatrix Willius]The standard solution is to have a boolean. Something like “isChangingData”. You set that to true at the beginning of what you want to do. The control then has
if isChangingData then return
in the TextChanged or whatever event. At the end of processing you set the boolean to false.[/quote]
I usually add two methods to a form or container to change the flag as it makes it more readable, at least for me.