Skip to main content

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

Hi

I'm not sure if this helps:

In the snipplet section for SWT you can find an example for a dynamic menu.

Snipplets:
http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/platform-swt-home/dev.ht
ml#snippets

Example:
http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/platform-swt-home/snippi
ts/snippet73.html

Hope this helps.

	Kristian

> -----Ursprüngliche Nachricht-----
> Von: pde-dev-admin@xxxxxxxxxxx [mailto:pde-dev-admin@xxxxxxxxxxx]Im
> Auftrag von Philippe Faes
> Gesendet: Montag, 2. Februar 2004 09:11
> An: pde-dev@xxxxxxxxxxx
> Betreff: [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?
>
> Thanks!
> --
> 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
>     http://www.elis.UGent.be/~pfaes
> ON1DEU   --   LPIC1  --  gpg-key:173720B6
>



Back to the top