[squeak-dev] 4.1 GUI Changes - Buttons not working in my code

Hannes Hirzel hannes.hirzel at gmail.com
Sat Jul 3 13:59:25 UTC 2010


Hello Jon,

Alignment issues are handled in class Morph. So instead of using an
AlignmentMorph you just use a regular instance of class Morph.

Something like

   m := Morph new.
   s1 := SimpleButtonMorph newWithLabel: 'start engine'.
   s2 := SimpleButtonMorph newWithLabel: 'stop engine'.
   m addMorphBack: s1.
   m addMorphBack: s2.
   m changeTableLayout.
   m hResizing: #shrinkWrap.
   m vResizing: #shrinkWrap.
   m openInWorld.

Or to get you started putting it into a SystemWindow

   model := Model new.
   w := SystemWindow labelled: 'Example'.
   w model: model.
   "A SystemWindow needs a model."

   m := Morph new.
   s1 := SimpleButtonMorph newWithLabel: 'start engine'.
   s2 := SimpleButtonMorph newWithLabel: 'stop engine'.
   m addMorphBack: s1.
   m addMorphBack: s2.
   m changeTableLayout.
   m hResizing: #shrinkWrap.
   m vResizing: #shrinkWrap.

   w addMorph: m frame: (0.0 at 0 corner: 1 at 1).
   w openInWorld.


--Hannes

On 7/2/10, Chris Muller <asqueaker at gmail.com> wrote:
> I think the LayoutPolicy's replaced AlignmentMorph...
>
> On Thu, Jun 24, 2010 at 8:23 AM, Jon Hylands <jon at huv.com> wrote:
>> On Wed, 23 Jun 2010 17:36:58 -0400, Jon Hylands <jon at huv.com> wrote:
>>
>>>So, the new Cog VM has finally given me a reason to jump onto 4.1. I
>>>downloaded Andreas' 4.1 Windows zip file, installed it on my robot,
>>>and it starts up and runs with no issues.
>>>
>>>I loaded my Brainbot server code from my Monticello repository, but
>>>whenever I try and open any of my GUIs, the buttons are non-clickable.
>>>In fact, I can't even bring up their halo - when I right click, it
>>>switches between the system window and the alignment morph, but never
>>>the buttons. If I explore the alignment morph, I can of course see all
>>>the submorphs where they should be.
>>>
>>>This code works in a 3.10.2 image, which is what I've been using up
>>>until now.
>>>
>>>I'm adding PluggableButtonMorph objects to an AlignmentMorph, which is
>>>then added to a SystemWindowWithButton.
>>>
>>>Has something about these things changed between 3.10.2 and 4.1?
>>
>> Just as a followup - without the alignment morph, buttons work fine.
>> But I really like being able to group together things like buttons...
>>
>> Later,
>> Jon
>>
>>
>>
>
>



More information about the Squeak-dev mailing list