views:

394

answers:

1

Is there some way to use the Menu.AttachToWidget(...) function of a gtk menu item to attach the menu to say a Gtk.Textview and have it handle showing the menu when needed. Or is creating an event handler for ButtonPressEvent and showing the menu there the only way to do it?

Or is there a third possibility that I'm missing?

Thanks in Advance.

+1  A: 

There is a third possibility that you are missing.

TextView.PopulatePopup is an event that TextView fires when the user right clicks within the TextView. You can handle this event and insert menu items into the existing TextView context menu, which has items for cut/copy/paste and input method. This is the preferred way of adding additional context menu items to TextView.

Links to docs:

anthony
Thanks for the answer. When I got the tumble weed badge for this question I kinda lost hope.
AvatarOfChronos