Adding a context menu to a Morph

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding a context menu to a Morph

Sean P. DeNigris
Administrator
I added instructions to the online book...
http://book.pharo-project.org/book/LanguageAndLibraries/GUI/contextmenus

Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Adding a context menu to a Morph

Helene Bilbo
Sean P. DeNigris wrote
I tried your instructions in Pharo 1.3 with a direct Subclass of Morph and noticed some differences to your description (which may very well be due to my lack of understanding..):

1) the examples work as well, if you do not add:
         handlesMouseDown: anEvent
            ^ true.

   if I did add handleMouseDown, my Morph did loose all other standard mouse actions, like beeing dragable.

2) defaultYellowButtonMenuEnabled
       ^ true.

   had to be included also if you did not want the default menu + some #addCustomMenuItems: aCustomMenu hand: aHandMorph _but also_ if you wanted a complete custom menu with #addYellowButtonMenuItemsTo: aMenu event: evt

Perhaps you have some more information on this?
BTW, thank you very much for the book entry, it’s much appreciated. I am a regular reader of the collaboractive book :)

Best regards, Helene.
Reply | Threaded
Open this post in threaded view
|

Re: Adding a context menu to a Morph

Sean P. DeNigris
Administrator
Helene Bilbo wrote
I tried your instructions in Pharo 1.3 with a direct Subclass of Morph and noticed some differences to your description (which may very well be due to my lack of understanding..):
Hmm... I was working on an ImageMorph subclass at the time. Maybe that causes the difference.

I'll take a deeper look when time permits.

Helene Bilbo wrote
   if I did add handleMouseDown, my Morph did loose all other standard mouse actions, like beeing dragable.
This is normal. When you take over mouse handling, you lose the standard "pick up morph" behavior.

Glad you got some use out of it!
Sean
Cheers,
Sean