[squeak-dev] Algernon modification to register as an eventListener into HandMorph

Igor Stasenko siguctua at gmail.com
Sat May 17 22:18:00 UTC 2008


2008/5/18 Balázs Kósi <rebmekop at gmail.com>:
> Hi,
>
> Algernon uses Hernan Tylim's MultipleFocusHolder code to capture
> keyboard events [1].
> I made a small modification [2] to use the event listener facilities
> in HandMorph instead.
> But I had to change HandMorph >> sendListenEvent:to: to get it work [3].
> In my version we dispatch the original event to the listeners, not
> copies of it, so we can set the wasHandled flag.
> This may cause problems in the other users [4], and may against its design.
> What do you think?
>
> Thanks, Balázs
>
> [1] MultipleFocusHolder code overrides some methods changed after its
> release; and it's released under LGPL, afaik.
> [2] Saved it into the Algernon repository:
> http://www.squeaksource.com/Algernon.html as Algernon-kb.13.mcz
> [3] The change from ar's code:
>
> sendListenEvent: anEvent to: listenerGroup
>        "Send the event to the given group of listeners"
>        listenerGroup ifNil:[^self].
>        listenerGroup do:[:listener|
>                listener ifNotNil:[listener handleListenEvent: anEvent copy]].
>
> to:
>
> sendListenEvent: anEvent to: listenerGroup
>        "Send the event to the given group of listeners"
>
>        listenerGroup ifNil: [ ^self ].
>        listenerGroup do: [ :listener |
>                listener ifNotNil: [
>                        listener handleListenEvent: anEvent ] ]
>
> [4] In my image they are EventRecorderMorph and RemoteHandMorph, and
> they both store the last event they handled.
> These can be fixed pretty easily, imho.
>

Well, i think its more logical to do copy of events in
EventRecorderMorph  and RemoteHandMorph
instead of HandMorph class. Really why such special event handlers
like above, which collecting events, should rely on different class to
receive a copy of events, instead of making copy themselves?

>



-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Squeak-dev mailing list