<div dir="ltr"><div>Thank you, Hannes. That is exactly the kind of info I have been trying to find.<br><br></div>Tim Cuthbertson<br><div><div><div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">H. Hirzel</b> <span dir="ltr"><<a href="mailto:hannes.hirzel@gmail.com">hannes.hirzel@gmail.com</a>></span><br>Date: Wed, Feb 22, 2017 at 5:34 PM<br>Subject: Re: [Newbies] Beginners Digest, Vol 123, Issue 4<br>To: "A friendly place to get answers to even the most basic questions about Squeak." <<a href="mailto:beginners@lists.squeakfoundation.org">beginners@lists.squeakfoundation.org</a>><br>Cc: <a href="mailto:ratcheer@gmail.com">ratcheer@gmail.com</a><br><br><br>Assuming you have named your instances of TextMorph and embedded them<br>
in the PasteUpMorph so that they are in the 'submorphs' collection of<br>
the PasteUpMorph<br>
<br>
you may access them by name from the PasteUpMorph with<br>
<br>
<br>
   self submorphs detect: [:m | m externalName = 't1']<br>
<br>
(access to morph named 't1').<br>
<br>
This is a moderate effort and allows you to construct the GUI through<br>
direct manipulation.<br>
<br>
Please note as well that in a recent trunk image the halo menu list of<br>
a SimpleButtonMorph has a 'set target' menu entry which allows you to<br>
set to any target by pointing at it.<br>
<br>
--Hannes<br>
<span class="im HOEnZb"><br>
<br>
On 2/22/17, Tim Cuthbertson <<a href="mailto:ratcheer@gmail.com">ratcheer@gmail.com</a>> wrote:<br>
</span><div class="HOEnZb"><div class="h5">> Tim,<br>
><br>
>> One of the articles on Morphic says you can create composite morphs<br>
> either programatically,<br>
>> using addMorph, or using drag and drop from the Objects menu of the<br>
> morphic World. I have<br>
>> done the latter, because it is easier to design my layout that way. Once<br>
> that has been done,<br>
>> how do I address the submorph from a browser? If I inspect my button<br>
> submorph, for example<br>
>>, all it will tell me about it is "a ScriptableButton<Button>(<wbr>1364754)". I<br>
> have no idea how to<br>
>> access that object in order to do anything with it. This is the crux of<br>
> my questions.<br>
><br>
> This is, in my opinion, the most significant limitation of Morphic for<br>
> interactive GUI creation. In the original Morphic in Self the way to<br>
> handle this was to simply search through all your submorphs for the one<br>
> you were interested in, usually by comparing the morphType string. In<br>
> Squeak we can add properties to Morphs very easily so that would be one<br>
> way to tag it. Something like:<br>
><br>
> | stopButton |<br>
> stopButton := nil.<br>
> self submorphsDo: [ :m | (m hasProperty: #stopButton) ifTrue: [<br>
>                                stopButton := m ] ].<br>
> stopButton ifNotNilDo: [ :b | b ... ].<br>
><br>
> Code like this will work even if there are no stopButtons at all and if<br>
> you add more than one the code will just use the last one and ignore the<br>
> others.<br>
><br>
> After creating the button you have to get its halo and use the red<br>
> button (menu) with the debug->inspect morph option to set the<br>
> #stopButton property.<br>
><br>
> An alternative to using specially created properties is to depend on the<br>
> morph's name. In your case it is "a ScriptableButton<Button>(<wbr>1364754)"..<br>
> So:<br>
><br>
> self subMorphsDo: [ :m | (m name includesSubString: 'Button') ifTrue:<br>
> ...<br>
><br>
> should work for you as long as there is only one button.<br>
><br>
> -- Jecel<br>
><br>
> Thank you, Jecel, for trying to help me solve my problem. However, my plan<br>
> is to have multiple sibling morphs for both the buttons and the texts.<br>
><br>
> So, I am diving in to trying to use addMorph: programatically to add<br>
> submorphs to my display. This allows me to hold a reference to each<br>
> submorph in named variables, through which I should then be able to specify<br>
> state changes and act on events to and from my submorphs.<br>
><br>
> Maybe my mindset is just too old fashioned. Back in the 90's, I programmed<br>
> MVC applications in VisualWorks. I thought Morphic was supposed to be much<br>
> easier to use than MVC, but so far, I have not been able to figure out how<br>
> to control my objects in Morphic.<br>
><br>
> Tim Cuthbertson<br>
><br>
</div></div></div><br></div></div></div></div>