|Issue ID: 00140|
Projekt: Abakus VCL
Sliders and Re-entrancy
I use the TAbVSlider in my application. The event handler for OnValueChange that I have takes about 1 second to execute. When I slide the control using the mouse or the up/down arrow keys, the event handler is called many, many times in a second. The code I wrote in the event handler is re-entered many times before it has completed the processing for the first event. The code is not re-entrant and gets very confused.
I need to prevent the event handler from being called again until it is has completed processing the previous event. At the same time, I have to ensure that event handler is called by the final change so that the Value in the slider was processed by my OnValueChange code.
i don't know your application but may you can use the OnValueChanged Event instead of the OnValueChange. A small demo you will find attached.
Another good way to prevent courious behavior is to create a global "busy"-flag which you check at begin of the slow Routine, if the flag is checked then Exit this routine.
Direct after the check you set this bit true and at end of this Routine you reset this flag.
OnValueChange.zip (221 kB)