logo       

[GOODIE] LabeledButtons-nk (was Re: A problem hindering SmallTalk's popula: msg#00816

lang.smalltalk.squeak.general

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

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

Attachment: LabeledButtons-nk.1.cs.gz
Description: GNU Zip compressed data

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise