-
Notifications
You must be signed in to change notification settings - Fork 241
Description
Having buttons with an :ONCLICK call back can trigger the :ONCHANGE suffix of a textField apparently depending on the order the widgets are added to the GUI structure.
In the code below clicking on the "up" button will trigger the :ONCONFIRM call back of the field many times depending on what the user does. The initial click will trigger an :ONCONFIRM call, each movement of the mouse while the click is held even moving off the button will trigger a call (likely once for every frame of movement), and the release of the button will trigger a call though only if moused over the button.
Where as trying the same on the "down" button will not produce any unexpected :ONCONFIRM callbacks.
CLEARGUIS().
LOCAL int IS GUI(200).
LOCAL ilButtonUp IS int:ADDBUTTON("up").
LOCAL ilField IS int:ADDTEXTFIELD("string").
LOCAL ilButtonDown IS int:ADDBUTTON("down").
SET ilButtonDown:ONCLICK TO { PRINT "down button". }.
SET ilButtonUp:ONCLICK TO { PRINT "up button". }.
SET ilField:ONCONFIRM TO { PARAMETER thing. PRINT "field was confirmed". }.
int:SHOW.
BRAKES OFF.
WAIT UNTIL BRAKES.
CLEARGUIS().
In my testing the order in which the callbacks where added doesn't appear to have much affect to the operation of this bug beyond delaying it until after the field's call back has gone off once.
I also tested with more buttons and it appears that only buttons added before the field will cause the issue and buttons added after will not.
I have not tested if nesting the buttons and field into there own BOX/LAYOUT will "fix" the issue.
This might be related to issue #2708 though I am not positive on that as the symptoms appear different.