Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pde-dev] dynamically changing pop-up menus

Hi everybody

(hope this is the right list for this ;-)
I'm developping a plug-in that contains a tree. I want different menus
popping up, depending on which TreeItem is selected.

How do I do that?

I tried two approches, both of which failed:
1. I have a SelectionListener that changes the menu for that tree each
time the selection is changed..
if(...) tree.setMenu(menu1); else tree.setMenu(menu2);
If I right-click on an item, it is selected and a menu pops up, but
often, it is the old menu, not the one I wanted. I guess the MenuShown
event is issued before the Selection event...

2. Upon every MenuShown event, I fill in the MenuItems I like for the
selected TreeItems. On a MenuHidden event, I dispose all the MenuItems
(but not the menu itself). 
Now the right menu shows up, but clicking a menu item doesn't trigger
the Listener for that menu item... (strange!)

Am I doing something completely wrong here?

ir. Philippe Faes
Ghent University - Department ELIS
Sint-Pietersnieuwstraat 41 -- B-9000 Gent
Tel:+32 9 264 89 10 - Fax:+32 9 264 35 94
ON1DEU   --   LPIC1  --  gpg-key:173720B6

Attachment: signature.asc
Description: This is a digitally signed message part

Back to the top