[beginner] assign widget to variable?

Ned Konz ned at bike-nomad.com
Wed Dec 5 04:16:57 UTC 2001


On Tuesday 04 December 2001 07:19 pm, morphic wrote:
> once you drag a widget out and place it somewhere, is there a way to assign
> it to a variable so that you can then send it messages? I realize you can
> create things with openInWorld, and that you can do a lot of things via
> halos and menus, but I also want to be able to send messages via a line of
> code to things already dragged out. e

You can do this easily in a workspace.

>From its menu, check "create textual references for dropped morphs". Then 
drop a Morph on the workspace. It will slide back to where it was, leaving 
its name (bound to the Morph in the Workspace's private dictionary).

>From there you can write code in the Workspace to use it.

There is also the clipboard; you can copy a Morph to the clipboard and refer 
to it as
       ActiveHand pasteBuffer

Or you can do something like (if you know there's only one of your kind of 
Morph about):

    MyMorphClass allInstances first

or
     MyMorphClass someInstance

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list