java - Access Popup menu in eclipse created with Menu(Control parent) constructor -


i have control, let's imagehyperlink imagehyperlink on have popup menu created this: menu menu = new menu(imagehyperlink); there way access menu (and menu items) programmatically assuming have access imagehyperlink? thanks

it common error assume constructed menu in way associated control specified in constructor! constructor in question defined as

public menu (control parent) {     (checknull (parent).menushell (), swt.pop_up); } 

so other words: menu associated shell of control, not control itself.

before menu acts popup menu of specific control, menu must explicitly set menu of control with

imagehyperlink.setmenu(menu); 

when has been done, menu can retrieved imagehyperlink.getmenu().


Comments