Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » use of MenuDetect event ?
use of MenuDetect event ? [message #441641] Wed, 18 August 2004 13:33 Go to next message
Larry Bergman is currently offline Larry BergmanFriend
Messages: 3
Registered: July 2009
Junior Member
I'm trying to detect SWT popup menus. I've registered for MenuDetect
events, but these are produced by any right-click, whether or not a menu
is actually displayed. Looking at the code for Control.showMenu, it looks
to me like the MenuDetect event should be sent when the menu is set
visible, not in all cases. Am I misinterpreting the meaning of this
event? If so, is there another way I can detect popups?

Thanks,
Larry Bergman
Re: use of MenuDetect event ? [message #441660 is a reply to message #441641] Thu, 19 August 2004 11:12 Go to previous message
Paul Singleton is currently offline Paul SingletonFriend
Messages: 37
Registered: July 2009
Member
Larry Bergman wrote:
> I'm trying to detect SWT popup menus. I've registered for MenuDetect
> events, but these are produced by any right-click, whether or not a menu
> is actually displayed. Looking at the code for Control.showMenu, it looks
> to me like the MenuDetect event should be sent when the menu is set
> visible, not in all cases. Am I misinterpreting the meaning of this
> event? If so, is there another way I can detect popups?

Yes I think you misinterpret MenuDetect, which reports
a *request* for a context menu, whether or not the control
has a popup menu. Maybe it shoulda been called ContextRequest...

Perhaps you need to handle the Show event from the popup?

Although depending why you are trying to detect popup menus,
maybe MenuDetect *is* right for you after all, it just needs
a bit of a rethink.

I generate dynamic context menus for individual tree items and
table cells by catching "MenuDetect" then repopulating and
showing the root shell's popup at the reported x/y.

Beware some shortcomings in keyboard-generated MenuDetect
events: you get the current mousepointer coords as event.x & .y,
with no indication that these are inappropriate (misleading),
so the (possibly multiple) selection on which a key-driven
context request has been raised cannot reliably be identified.
But under the assumption that they are mouse-generated, they seem
great (haven't tried non-Windows).

Paul Singleton
Previous Topic:Images in TableTree
Next Topic:Virtual tables with multiple columns
Goto Forum:
  


Current Time: Mon May 13 02:38:03 GMT 2024

Powered by FUDForum. Page generated in 0.03605 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top