Is there a tandard way to attach context menus

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

Is there a tandard way to attach context menus

Herbert König
Hello all,

is there a standard way to attach a context menu to a morph?

It's fairly easy to do by checking for yellowButtonPressed and
manually firing up a MenuMorph.

But it is sufficient to implement #addCustomMenuItems:hand: to get an
enhanced Halo menu while #addYellowButtonMenuItemsTo:event: and
#hasYellowButtonMenu don't help.

So is there a predefined way without everybody doing his own?

Thanks,


Herbert                          mailto:[hidden email]

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Is there a tandard way to attach context menus

Sean P. DeNigris
Administrator
To add a context menu to a morph class:
1. Enable mouse handling:
  #handlesMouseDown: anEvent
    ^ true.
2. Decide if you want to start with the standard menu, or go totally custom
  a. If you want to include the standard options:
    1. defaultYellowButtonMenuEnabled
        ^ true.
    2. #addCustomMenuItems:hand: with your morph-specific items
  b. To take full control and start from scratch, specify menu items in #addYellowButtonMenuItemsTo:event:

Probably too late to help the OP ;-) But I wanted to document this, especially for myself when I forget in two weeks!

Sean
Cheers,
Sean