[comp.lang.eiffel] event handler

vdaele@cstw35.prl.philips.nl (Marc van Daele) (02/08/90)

Can someone explain me how events flow from a button up to his parents?

I started with the class comm_button.e, in which I removed the
pay_attention (button_release) instruction.
Instead I putted a button_release_action and a button_press_action
in the window class from which my comm_button class inherited.
Then I created a window, with a button on it (using the jogger example in
~/Eiffel/examples/graphics/animation)

If I click on the button, a button_press event is sent to the button (correct).
If I release, nothing happens, while I expected a button_release event to be 
sent to the window.  WHY ?
Furthermore, if I click (without releasing) and then leave the button,
TWO leave_notify events are sent.  WHY ?
If I click on the window itself, there is a button_press event sent to the 
window (correct) and when I release, a button_release is sent to the window 
(also correct).

If I remove the pay_attention (button_press) in the button class, we get the
following running around of messages.
If I click on the button, a button_press event is send to the window AND 
a leave_notify event is sent to the button.  Leaving the button causes
no extra sending of events.
If I release the button, a button_release event is sent to the window AND
an enter_notify event is sent to the button.

Why is there a button_release event sent to the window in the second case, 
and not in the first case , while the pay_attention (button_press) instruction
should not effect the sending of button_release events ?

Can somebody explain me the logic behind this ?

disclaimer : IF this is a stupis question THEN I'm a novice eiffel user

-------------------------------------------------------------------------------
Marc Van Daele
vdaele@cst.prl.philips.nl

If you're no part of the solution, you're part of the problem