creating a launcher morph

Andrew P. Black black at cse.ogi.edu
Sun May 6 20:54:05 UTC 2001


>Hi everybody. I hope someone can help me or point me in the right direction.
>I need to make a simple launcher, just a couple of buttons.

I posted a version of such a Launcher to this group just a couple of 
weeks ago.  In turn, it was a version of a launcher of Jim Benson's 
from the Swiki.  I still have to put this version back on the Swiki, 
so in the meantime, here it is again. (see attachment)


>One would create an instance of a class and thew others send some 
>messages to the instance.
>(Actually in one case I need to get some input from the user, just a 
>number. I'm assuming there's an easy way to do that, but i'm not 
>there yet)

Starting from the attached changeset, if you change the mouseUp 
events for the various buttons, you can change what happens.  Just 
make your own object with the right behavior, and make that object 
the target of the button event.

>I was looking at a tutorial on how to create a traffic light, and it 
>got me only so far. Right now I have a subclass of Aligment morph 
>with a couple of BasicButtons, but that's it.
>Should I be subclassing the basic buttons? How trap the button down 
>event from one of the buttons and send a message to my 
>AlignmentMorph subclass?

Just override #handlesMouseUp: or handlesMouseOver: or whatever to 
answer true, and then make sure that you define the corresponding 
#mouseUp:, #mouseOver method, or whatever.   But one thing that you 
should be aware of is that allignmentMorphs are really now only for 
backward compatibility.  ANY Morphs can now do alignment; rather than 
inheriting form AllignmentMorph, it delegated to TableLayout.  This 
is what I have to write up!   Again, the attached example should get 
you going.


>
>Am I approaching this completely the wrong way??

No, I think that you are on the right track.

>
>One of the problems I have with morphs is that there seems to be a 
>lot of "magic" going on behind the scenes, and there's no 
>comprehensive tutorial or a reference guide, or something like that. 
>Every time I try to look at what's going on it just overwhelms me.

I think that this is a valid comment.  I have an item on my list to 
start writing that basic introduction, before I forget what it was 
like not to know.  There are a lot of useful fragments on the Swiki, 
but no one comprehensive place to start.

Unfortunately, I also have to do the stuff that I'm paid to do!  And 
right now, I'm going to ride my bike while the sun shines ;-)

	Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Launcher.5.cs
Type: application/octet-stream
Size: 4023 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20010506/d9b04696/Launcher.5.obj


More information about the Squeak-dev mailing list