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

Balázs Kósi rebmekop at gmail.com
Sat May 17 21:49:29 UTC 2008


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.



More information about the Squeak-dev mailing list