IconicButton and Events
Stef Telford
stef at chronozon.artofdns.com
Mon Apr 15 19:35:42 UTC 2002
hello,
new squeaker here, so please go gently :)
i am creating a new IconicButton, and am
wondering if there is a way to define a method during
'instantiation' time, rather than adding it onto the
current instance by using the on: #mouseDown which it
currently is.
Since this is for a HUI (Human User Interface)
and there could be a lot of buttons, it doesnt really
make much sense to subclass all 20 buttons, each with
what is potentially a minor difference. Current code
goes something like this:
s:=GradientFillMorph new.
s addMorphCentered: (a:=IconicButton new).
a on: #mouseDown send: #value to:[Transcript show:'you clicked'].
s openInWorld.
Okay, barring the fact that its not the worlds
most awe inspiring nor amazing piece of code (the variables
are mainly there as its being tested in a workspace), is that
the 'cleanest' way to add an event into an Instance of
a pre-defined Morph at 'creation' time ?
Assuming its not, in that case, how is it done ?
Simple question really, but its been a 'sore spot'
for a while now :\
regards
Stef
More information about the Squeak-dev
mailing list
|