[GOODIE] LabeledButtons-nk (was Re: A problem hindering SmallTalk's popularity:)

Ned Konz ned at bike-nomad.com
Wed Jul 31 18:22:40 UTC 2002


On Tuesday 30 July 2002 07:12 pm, Richard A. O'Keefe wrote:
> Doing it again, I might make RadioGroup a subclass of
> AlignmentMorph.

Good summary, Richard; thanks!

I might also add:

ANY MORPH CAN: be an AlignmentMorph.

Ever since Andreas moved the table alignment stuff down into Morph,
AlignmentMorph has been just a convenient constructor for a BorderedMorph.
It doesn't have any interesting behavior
(other than a slightly different keyboard focus policy; I'm not sure how important that is).

You can lay out submorphs either by using the TableLayout
(which is what AlignmentMorph uses),
the ProportionalLayout (which is what the SystemWindows use),
or by defining your own layoutInBounds:

The ProportionalLayout is often overlooked;
it allows each submorph to have its own bounds rectangle
computed separately based on a simple spec.

The spec computes the corners of the submorph bounds from a
combination of a proportion of the owner bounds plus (or minus)
a fixed pixel offset.

Of course, in the RadioButton case, you don't even need a layout policy,
since the submorphs don't have to re-position themselves.

So you could have a structure (for 3 buttons with labels) that looks like this:

RadioButtonMorph
	EllipseMorph
	StringMorph
	EllipseMorph
	StringMorph
	EllipseMorph
	StringMorph

I've attached a little change set that adds the ability to add arbitrary labeled Morphs
(including buttons) to any Morph.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LabeledButtons-nk.1.cs.gz
Type: application/x-gzip
Size: 1093 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020731/2a90d1b7/LabeledButtons-nk.1.cs.bin


More information about the Squeak-dev mailing list