Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
a morph has a name
Last updated at 11:14 am UTC on 15 December 2017
A morph has a default "internal" name which you get with
 aMorph name.

It is constructed using the identityHash value.

Example
 r := RectangleMorph new extent: 100@50; openInWorld.
 r name
    'a RectangleMorph(406826)'


However you may use #setNameTo: / knownName to work with a specific "external" name for the morph.



Example

To open a note card with a named PasteUpMorph do

 p := PasteUpMorph new setNameTo: 'myNote'; extent: 640@480; openInHand.

But
 p name 
is
 'a PasteUpMorph<myNote>(1129382)'

whereas
 p externalName 
and
 p knownName

is
'myNote'



To get a facility to create named post-it Morphs or slides for a presentation you may add the command
 PasteUpMorph new setNameTo: 'myNote'; extent: 640@480; openInHand.

to a menu and ask with a FillInTheBlankMorph for the name.

 PasteUpMorph new setNameTo: (FillInTheBlankMorph request: 'What the name of the card?'); extent: 640@480; openInHand.

You may as well add a property #isNoteCard or #isSlide so that later you may retrieve all your note cards easier in the image.

 PasteUpMorph new 

 setNameTo: (FillInTheBlankMorph request: 'What the name of the card?'); 

 setProperty: #isNoteCard toValue: true; 

 extent: 640@480; 

 openInHand.