[squeak-dev] Re: generalizedYellowButtonMenu

Andreas Raab andreas.raab at gmx.de
Thu Sep 10 02:24:23 UTC 2009


Chris Muller wrote:
> Hi, I've had the exact same problem ever since 3.9.  The problem
> manifests if you want to handle the yellow button in MyCustomMorph,
> when it is embedded in a standard Morph, such as RectangleMorph.

Can either you or Elöd describe what the actual problem is you are 
seeing? You both say that there is "some" problem but you don't describe 
it terms of expected vs. observed behavior. The problem isn't obvious to 
me, for example when I embed a TextMorph into a RectangleMorph the 
behavior is just what I would expect (i.e., the text menu in the text 
morph and the generalized context menu in the rectangle morph).

One possible issue that I can see with the code is that it would not 
work with a custom event handler, i.e.,

m := Morph new.
m on: #mouseDown send: #value: to:[:evt| evt yellowButtonPressed 
ifTrue:[...]].

Is this the problem you are describing? If so I'm not sure why you say 
you can't fix the issue in your custom Morph subclass since it's trivial 
to just reimplement mouseDown: to not do that.

Cheers,
   - Andreas

> For Maui, I tried so hard to find a solution that would allow
> MyCustomMorph to intercept and respond to the yellow button with my
> own handler, that would not require a change to core 3.9 Squeak code.
> 
> I was unsuccessful.  To do the above, I had to revert:
> 
>   Morph>>#mouseDown:
> 
> to the version from 3.8.  Specifically, you may simply delete these
> lines that were erroneously added in 3.9:
> 
> 	evt yellowButtonPressed
> 		ifTrue: ["First check for option (menu) click"
> 			^ self yellowButtonActivity: evt shiftPressed].
> 
> but be sure to _keep_ these original lines from 3.8, of course:
> 
> 	self eventHandler
> 		ifNotNil: [self eventHandler mouseDown: evt fromMorph: self]
> 
> This, btw, also restores the correctness of the methods *comment*,
> which also became wrong when the 3.9 change was introduced.
> 
> I have been running with this fix in my 3.9 image for 2 years with no
> ill-side-effects, but with proper eventHandling for the yellow button
> (not to mention cleaner code).
> 
> Cheers,
>   Chris
> 
> 
> On Tue, Sep 8, 2009 at 10:57 PM, Andreas Raab <andreas.raab at gmx.de> wrote:
>> Elöd Kironský wrote:
>>> Can someone please explain what is the preference
>>> "generalizedYellowButtonMenu" for? It is by default enabled in Squeak and it
>>> breaks the yellowButtonPressed event in mouseDown: methods. I've tried to
>>> Google it, but the only thing I found, that it makes problems in other
>>> packages too. Am I missing something? This was introduced somewhere in 3.9 I
>>> think, but I'm not sure where and why. Does someone know? Thanks in advance,
>> It enables the use of context (yellow button) menus on arbitrary Morphs. I'm
>> not sure what you mean by "it breaks the yellowButtonPressed event in
>> mouseDown: methods" though. Do you have a more specific description of the
>> problems you are encountering?
>>
>> Cheers,
>>  - Andreas
>>
>>
> 
> 




More information about the Squeak-dev mailing list