[Mono-list] popup a menu again
Ben Motmans
Ben Motmans <ben.motmans@gmail.com>
Mon, 17 Jan 2005 02:10:07 +0100
EventBox eventBox = new EventBox();
Label labelPopup = new Label("Click here to show a popup menu");
eventBox.ButtonPressEvent += new ButtonPressEventHandler(OnLabelPopupClick);
eventBox.Add(labelPopup);
popupMenu = new Menu();
MenuItem menuPopup1 = new MenuItem("Popup item 1");
MenuItem menuPopup2 = new MenuItem("Popup item 2");
MenuItem menuPopup3 = new MenuItem("Popup item 3");
popupMenu.Add(menuPopup1);
popupMenu.Add(menuPopup2);
popupMenu.Add(menuPopup3);
--
private void OnLabelPopupClick (object sender, ButtonPressEventArgs args) {
//TODO: check if the pressed button == right mouse button, you
probably need to check args.Button
popupMenu.Popup(null, null, null, IntPtr.Zero, args.Event.Button,
args.Event.Time);
popupMenu.ShowAll();
}
--
something like this should do the trick
On Mon, 17 Jan 2005 11:46:50 +1100, roy <roy@websitemanagers.com.au> wrote:
>
> I really want to popup a menu when right click the label using mono on
> lunix, can you help me, give me a example. thanks
> roy