Hello Tim
Please find another example at the bottom which illustrates the access to morphs.
A SimpleButtonMorph embedded in a PasteUpMorph gets access to siblings of the PasteUpMorph it is embedded in.
a simple presentation.
Regards
--Hannes
On 2/23/17, Tim Cuthbertson ratcheer@gmail.com wrote:
Thank you, Hannes. That is exactly the kind of info I have been trying to find.
Tim Cuthbertson
---------- Forwarded message ---------- From: H. Hirzel hannes.hirzel@gmail.com Date: Wed, Feb 22, 2017 at 5:34 PM Subject: Re: [Newbies] Beginners Digest, Vol 123, Issue 4 To: "A friendly place to get answers to even the most basic questions about Squeak." beginners@lists.squeakfoundation.org Cc: ratcheer@gmail.com
Assuming you have named your instances of TextMorph and embedded them in the PasteUpMorph so that they are in the 'submorphs' collection of the PasteUpMorph
you may access them by name from the PasteUpMorph with
......
| buttonActionBlock createButtonBlock createSlideBlock content1Block slideCollection | buttonActionBlock := [:button | button owner submorphAfter isNil ifTrue: [button owner owner submorphs first show] ifFalse: [button owner hide. button owner submorphAfter show]]. createButtonBlock := [| b | b := SimpleButtonMorph new label: 'next'. b target: buttonActionBlock. b actionSelector: #value:. b arguments: (Array with: b)]. createSlideBlock := [:aColor :aString | | p | p := PasteUpMorph new extent: 640 @ 480; color: aColor. p addMorph: (createButtonBlock value openInWorld position: 600 @ 450). p setProperty: #isSlide toValue: true. p addMorph: (TextMorph new contentsWrapped: aString; fontName: 'BitstreamVeraSans' pointSize: 24; extent: 500 @ 50; position: 20 @ 20). ]. content1Block := [:pm | pm addMorph: (RectangleMorph new extent: 50 @ 50; position: 20 @ 120; color: Color red). pm addMorph: (RectangleMorph new extent: 50 @ 50; position: 20 @ 180; color: Color blue). pm addMorph: (RectangleMorph new extent: 50 @ 50; position: 20 @ 240; color: Color white). pm addMorph: (RectangleMorph new extent: 50 @ 50; position: 20 @ 300; color: Color black). pm addMorph: (TextMorph new contentsWrapped: '4 instances of PasteUpMorph'; fontName: 'BitstreamVeraSans' pointSize: 24; extent: 500 @ 50; position: 80 @ 120)]. slideCollection := Morph new extent: 640 @ 480. slideCollection setProperty: #isSlideCollection toValue: true.
slideCollection addMorphBack: (content1Block value: (createSlideBlock value: Color yellow value: 'Simple presentation - slide 1')).
slideCollection addMorphBack: (createSlideBlock value: Color green value: 'slide 2').
slideCollection addMorphBack: (createSlideBlock value: Color gray value: 'slide 3').
slideCollection addMorphBack: (createSlideBlock value: Color blue value: 'slide 4').
slideCollection openInWorld; position: 30 @ 30
beginners@lists.squeakfoundation.org