GUI Button Quirkiness

Started by RickJ, Mon 09/11/2009 03:00:53

Previous topic - Next topic

RickJ

I have been experimenting with the button control and have found a minor unexpected behavior that perhaps falls short of being a bug but is probably worth mentioning. 

I am attempting to implement a "set" button having two states.  When it is in the "off" state it can be pushed to switch it to the "on" state.  When in the "on" state it no longer responds to a  push; it's state would be typically be reset to the "off" state by another button or by the script. 

In the initial "off" state the button control is given three separate graphics for normal, mouse over, and pushed conditions.  In the "on" state the pushed graphic is used for all three conditions.  The button operates in the following sequence:

1.  Button in "off" state - Normal Graphic shown
2.  Move curso over button - Mouse Over graphic shown
3.  Mouse button down - Pushed graphic shown
4. Script reassigns button graphics for "on" state  - Pushed graphic shown
5. Mouse button up - Previously assigned Mouse Over graphic shown for one game cycle
6. One game cycle later - Newly assigned Mouse Over graphic (i.e. Pushed) is shown.
7. move cursor away from button - Pushed (newly assigned normal graphic) is shown

The unexpected behavior occurs at step #5 when the mouse is first released.  The old MouseOver graphic is displayed for one game cycle and then the new MouseOver graphic is displayed.  It doesn't matter how long the button is held down either.

I suspect this may have something to do with timing and the way the engine is executing my script and updating button properties.  It it's very difficult or nearly impossible to remedy this situation iot's p[robaly not worth the effort.  On the other hand if it is as simple as re-fetching the mouse over graphic when the button up event occurs then it is probably a worth while task. 

In any case I thought this was an interesting little detail to share.





Pumaman

Interesting, I'll see if I can reproduce this.

RickJ

I can make an example available if you like.

Pumaman

If you've got one easily to hand, that would be useful, thanks!

SMF spam blocked by CleanTalk