How can I reinitialize the event handler
ned at bike-nomad.com
Sun Apr 7 16:34:54 UTC 2002
On Sunday 07 April 2002 04:15 am, ducasse wrote:
> Now I want to do it for Morphs. This works well except for events.
> Apparently the event handler is created once at initialization time and
> after even if we compile new method dealing with event like handles...
> they are not taken into account.
The typical handler code (in Morph) for events looks like this:
self eventHandler ifNotNil:
[self eventHandler mouseDown: evt fromMorph: self].
If you define a new mouseDown: method it will be used.
> This is not a problem for normal
> programming but for my purpose I would like to know if there is a method
> that I can invoke manually from within an inspector that would reset the
> event handler. Just to show that I do not have to create another instance
> to test the new behavior.
Also, even if you use the event handler, you can do this. For instance, in
your initialization (or elsewhere) you can say:
self on: #mouseDown send: #mouseDownEvent:morph: to: self
and then when the event occurs you will be sent the event and the morph to
You can later redefine #mouseDownEvent:morph: at will and see the new
currently: Stanwood, WA
email: ned at bike-nomad.com
More information about the Squeak-dev