[BUG] SpinButton event sequence

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[BUG] SpinButton event sequence

Boris Popov, DeepCove Labs (SNN)
[following applies to 7.4.1 as well as mar07.3]

Attached is a demo parcel that demonstrates the problem much better than
I could describe it, but by hooking up event handlers to all 4 events
and clicking on arrows to change the value of a spin button results in
the following,

(event name) (current value)

Open Window:
 enter 0

Click Up:
 exit 0
 change 0
 enter 1

Click Up Again:
 exit 1
 change 1
 enter 2

Click Down:
 exit 2
 change 2
 enter 1

whereas other widgets normally trigger change events *after* the new
value had been set, so I expect to see,

Open Window:
 enter 0

Click Up:
 exit 0
 change 1
 enter 1

Click Up Again:
 exit 1
 change 2
 enter 2

Click Down:
 exit 2
 change 1
 enter 1

The following fix addresses the problem, even though it reserves the
order of change and enter slightly,

SpinButtonController>>pressAction
 "Do the action associated with pressing the spin button."
 | compositeView |
 view isEnabled ifFalse: [^self].
 self requestValueChange ifFalse: [^self].
 view triggerEvent: #clicked.
 compositeView := view container container.
 compositeView controller deactivate.
 view isUp ifTrue: [view spinUp] ifFalse: [view spinDown].
 self valueChange.
 compositeView controller activate valueChange.
 compositeView container container takeKeyboardFocus


Open Window:
 enter 0

Click Up:
 exit 0
 enter 1
 change 1

Click Up Again:
 exit 1
 enter 2
 change 2

Click Down:
 exit 2
 enter 1
 change 1

Cheers!

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.


SpinButtonTest.zip (4K) Download Attachment