Wiki Navigation
- Loading...
Question
How do I show a context menu?
Answer
To show a context menu (in the middle of the screen) simply use the following code:
private int ShowContextMenu() { GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlgMenu != null) { dlgMenu.Reset(); dlgMenu.SetHeading("Header"); dlgMenu.Add("line 1"); dlgMenu.Add("line 2"); ... dlgMenu.DoModal(PARENT_WINDOW_ID); if (dlgMenu.SelectedLabel == -1) // Nothing was selected return EventAction.Nothing; return dlgMenu.SelectedLabel; } }
This page has no comments.