Morphic - widget subclassing and inheritance

Ned Konz ned at bike-nomad.com
Wed Aug 6 15:01:39 UTC 2003


On Wednesday 06 August 2003 06:22 am, Geza Lakner MD wrote:

> I am a newbie in Morphic and Smalltalk, and I just can't get around
> with this one. First, it is very painful to build and handle a
> usable, conventional dialog box in Morphic.
> This was my way, please comment it if there is a more "squeakish"
> (... elegant..) way to do it:
>
> 1. make a morphic project
> 2. add a system window morph via the World menu
> 3. add a button via the World menu
> 4. add a text field via the World menu
> 5. embed 3-4. into 2 via the halo menu

The halo menu embedding is mostly for use in the eToys environment.

Especially with system windows, it is not usually a good idea to use 
the halo embedding. These really expect to be built programatically.

Was there something that the SystemWindow gave you that you needed for 
your dialog box?

There are, by the way, a number of quick dialogs in the system if you 
just want to get some text entered, or to display something, or get a 
choice from the user. PopUpChoiceMorph, FillInTheBlankMorph, 
#inform:, #confirm: etc.

There have been several projects aimed at making direct-manipulation 
GUI builders.

See the Swiki page on GUI builders:
http://minnow.cc.gatech.edu/squeak/1576

> Now, all these GUI mparts are programatically, practically
> inaccesible in the usual way. They have no global names (just some
> instantiation number in parenthesis), nor could they be pruned into
> existing classes via renaming or something like this. The only way
> I saw, is to subclass each widget. 

You shouldn't have to subclass widgets to get the job done. The button 
classes and other morphs are all pluggable with respect to button 
actions, targets, and arguments, and most morphs also have pluggable 
event handlers:
	myMorph on: #mouseDown send: #someSelector to: myMorph.

There is a family of pluggable morphs that is often used for 
"conventional" UI building. For instance, the browsers and other 
tools are built from them. 

Take a look at the pluggable morph tutorial:
http://minnow.cc.gatech.edu/squeak/2962

And the FAQ on Morphic entry fields:
http://minnow.cc.gatech.edu/squeak/796

Plus I assume you've looked at the Morphic page:
http://minnow.cc.gatech.edu/squeak/30

> I think Squeak is a very nice platform but conventional programmers
> will have their hair raised up ;-) with the vastly underdocumented
> Morphic. Each tutorial picks a bells-and-whistles single morph to
> sing, turn or gallop around ;-) (I know, I know: Squeak is a
> schoolboy-oriented environment... ) via scripting or through
> Workspace direct manipulation but neither tutorial mentions how to
> set up conventional interaction like building dialog boxes, data
> entry forms; how to "wire in" keyboard navigation between data
> entry widgets (e.g. tabbing cycle) etc.

Tabbing between entry widgets is one of those things that has more or 
less worked from time to time. We put some work into fixing it a 
while ago, but I don't think it's gotten any attention since then.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list