[beginner] assign widget to variable?

Joshua 'Schwa' Gargus schwa at cc.gatech.edu
Wed Dec 5 06:28:38 UTC 2001


Hi Morphic,

Actually, the name 'book1559' is local to the Workspace that you dropped it
on; if you inspect the value of the same name in a new Workspace, it will
be nil.  It is not a global identifier for the morph; as Ned said, it
binds the name to the morph in the Workspace's dictionary of bindings.

Joshua


On Tue, Dec 04, 2001 at 09:53:36PM -0800, morphic wrote:
> ok, got it. thanks for the many ways. grabbing the widget and dropping it on the rhs of an assignment seems most direct. my problem was that (apparently) inspecting a widget doesn't yield a straightforward specification of how to refer to it. For example, the inspector opens with the title "a BookMorph(1559)" but the book's reference after drag-and-drop is "book1559".
> 
> e
> 
> > -----Original Message-----
> > From: Ned Konz [mailto:ned at bike-nomad.com]
> > Sent: Tuesday, December 04, 2001, 8:16 PM
> > To: squeak-dev at lists.squeakfoundation.org
> > Subject: Re: [beginner] assign widget to variable?
> > 
> > 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