[Help]Collapsing morphs in system window with button
Lic. Edgar J. De Cleene
edgardec2001 at yahoo.com.ar
Sun Jan 26 18:39:25 UTC 2003
Skipped content of type multipart/alternative-------------- next part --------------
'From Squeak3.4gamma of ''7 January 2003'' [latest update: #5168] on 26 January 2003 at 3:35:38 pm'!
!Quimica methodsFor: 'initialization' stamp: 'EDC 1/2/2003 08:11'!
initialize
| frame buttons max ima worldToUse f esteBoton |
iones _ #('Ag+' 'Pb++' 'Hg++' 'Bi+++' 'Cu++' 'Cd++' 'As+++' 'Sb+++' 'Sn+++' 'Al+++' 'Cr+++' 'Fe+++' 'Ni++' 'Co++' 'Mn++' 'Zn++' 'Ca ++' 'Ba++' 'Sr++' 'Mg++' 'Na+' ).
solucionIncognita _ OrderedCollection new.
ultimoPrecipitado _ 0.
losReactivos _ Array new: 6.
#('HCI' 'H2S' 'NH40H' 'NH4Cl' '(NH4)2S' '(NH4)2CO3' ).
self setFolder.
f _ Form fromFileNamed: 'SqueakChem.jpg'.
f borderWidth: 2.
ima _ ImageMorph new.
ima image: f.
frame _ AlignmentMorph newColumn.
buttons _ OrderedCollection new add: (SimpleButtonMorph new label: 'Hacer solucion ';
target: self;
actionSelector: #solucion);
add: (SimpleButtonMorph new label: 'Resetear directorio';
target: self;
actionSelector: #resetFolder);
add: (SimpleButtonMorph new label: 'Residuo';
target: self;
actionSelector: #residuo);
add: (SimpleButtonMorph new label: 'Filtrado';
target: self;
actionSelector: #filtrado);
add: (SimpleButtonMorph new label: 'Test cation';
target: self;
actionSelector: #cation);
add: (SimpleButtonMorph new label: 'Prueba';
target: self;
actionSelector: #solucionDePrueba);
add: (SimpleButtonMorph new label: 'Ayuda';
target: self;
actionSelector: #ayuda);
yourself.
"Add the buttons to the same frame"
buttons
reverseDo: [:each | frame addMorph: each].
"Compute the max width"
max _ 0.
buttons
do: [:each | max _ each width max: max].
"Set all widths to the max value"
buttons
do: [:each | each width: max;
color: Color gray].
"Include the frame into the receiver"
ima addMorph: frame.
ima openInWorld.
f _ Form fromFileNamed: 'Clor.gif'.
esteBoton _ IconicButton new.
esteBoton initialize.
esteBoton labelGraphic: f.
esteBoton target: self.
esteBoton actionSelector: #clorhidrico.
esteBoton position: 120 @ 0.
esteBoton openInWorld.
ima addMorphFront: esteBoton fromWorldPosition: esteBoton positionInWorld.
f _ Form fromFileNamed: 'sulf.gif'.
esteBoton _ IconicButton new.
esteBoton initialize.
esteBoton labelGraphic: f.
esteBoton target: self.
esteBoton actionSelector: #sulfhidrico.
esteBoton position: 180 @ 0.
esteBoton openInWorld.
ima addMorphFront: esteBoton fromWorldPosition: esteBoton positionInWorld.
f _ Form fromFileNamed: 'amon.gif'.
esteBoton _ IconicButton new.
esteBoton initialize.
esteBoton labelGraphic: f.
esteBoton target: self.
esteBoton actionSelector: #hidroxAmo.
esteBoton position: 240 @ 0.
esteBoton openInWorld.
ima addMorphFront: esteBoton fromWorldPosition: esteBoton positionInWorld.
f _ Form fromFileNamed: 'sulfamon.gif'.
esteBoton _ IconicButton new.
esteBoton initialize.
esteBoton labelGraphic: f.
esteBoton target: self.
esteBoton actionSelector: #sulfurAmon.
esteBoton position: 300 @ 0.
esteBoton openInWorld.
ima addMorphFront: esteBoton fromWorldPosition: esteBoton positionInWorld.
f _ Form fromFileNamed: 'carboamon.gif'.
esteBoton _ IconicButton new.
esteBoton initialize.
esteBoton labelGraphic: f.
esteBoton target: self.
esteBoton actionSelector: #carbonAmon.
esteBoton position: 360 @ 0.
esteBoton openInWorld.
ima addMorphFront: esteBoton fromWorldPosition: esteBoton positionInWorld.
f _ Form fromFileNamed: 'dicrom.gif'.
esteBoton _ IconicButton new.
esteBoton initialize.
esteBoton labelGraphic: f.
esteBoton target: self.
esteBoton actionSelector: #dicrom.
esteBoton position: 420 @ 0.
esteBoton openInWorld.
ima addMorphFront: esteBoton fromWorldPosition: esteBoton positionInWorld.
worldToUse _ ima world.
"I'm assuming we are already in a world"
ventana _ (SystemWindow labelled: 'SqueakChem')
model: nil.
ventana
bounds: (ima position - (0 @ ventana labelHeight + ventana borderWidth) corner: ima bottomRight + ventana borderWidth).
ventana
addMorph: ima
frame: (0 @ 0 extent: 1 @ 1).
ventana openCenteredInWorld.
ImagenArmada _ ima! !
More information about the Squeak-dev
mailing list
|