Event handling with scrollbar
Posted: Thu Mar 13, 2014 11:00 pm
Hi all,
I've just come across something interesting with the scrollbar gadget. It's a very simple scenario, there is an edit box on my form and a scrollbar (other stuff as well of course, but these are the only two of relevance here). I have some code in the LostFocus event for the edit box that writes the value into a variable. This works fine when the focus is lost by clicking on another gadget (i.e. a Save button or another field), but if I click on the Scrollbar, then the scrollbar event is fired first before the LostFocus event on the editbox. This is not desirable as the scrollbar event triggers a field refresh, so the field values are changed before the LostFocus takes effect, and therefore the LostFocus code is querying the wrong (refreshed) value. I've tried moving the event code around so that the scrollbar event is placed after the lostfocus event but this doesn't make any difference. Has anyone else come across this behaviour, and if so any ideas on how to prevent it?
Thank you.
I've just come across something interesting with the scrollbar gadget. It's a very simple scenario, there is an edit box on my form and a scrollbar (other stuff as well of course, but these are the only two of relevance here). I have some code in the LostFocus event for the edit box that writes the value into a variable. This works fine when the focus is lost by clicking on another gadget (i.e. a Save button or another field), but if I click on the Scrollbar, then the scrollbar event is fired first before the LostFocus event on the editbox. This is not desirable as the scrollbar event triggers a field refresh, so the field values are changed before the LostFocus takes effect, and therefore the LostFocus code is querying the wrong (refreshed) value. I've tried moving the event code around so that the scrollbar event is placed after the lostfocus event but this doesn't make any difference. Has anyone else come across this behaviour, and if so any ideas on how to prevent it?
Thank you.