Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Working on Morph with click, drag, halos
Last updated at 4:51 am UTC on 22 December 2006
See the pictures on spanish page of tutorial http://ar.geocities.com/edgardec2001/CalcuMorph.htm
Open the World menu and select BorderedMorph.
Repeat and select SimpleButtonMorph
Select SimpleButtonMorph, via halo select change label, type 1.

Again via halo, select siblings, multiple siblings, type 9.
Select each button and move until is on top of BorderedMorph , follow picture example.
Uploaded Image: Picture 6.png
when you do the all graphical manipulation, wish translate to code
To initialize method, we add now:

self display: TextMorph new. "this shows the calculator output later"
display contentsWrapped: '0'; "right format numbers "
color: Color red;
setBorderWidth: 1 borderColor: Color red.
self format.
self addMorph: display.
1 to: 9 do: [:numero| self addMorphBack: (SimpleButtonMorph new label: numero asString; target: self;
color: Color white;
actionSelector: #ingresaValor: ;
arguments: (Array with: numero))]. "each button fires ingresaValor: message to his container or Owner with value"
(SimpleButtonMorph new label: '0'; target: self;
color: Color white;
actionSelector: #ingresaValor: ;
arguments: (Array with: 0)).
self addMorphBack: (SimpleButtonMorph new label: '+' asString; target: self;
color: Color blue;
actionSelector: #sumar).
self addMorphBack: (SimpleButtonMorph new label: '=' asString; target: self;
color: Color blue;
actionSelector: #resultado)
CalculadoraMorphica.cs