tsc_WizardMenu
This specialised form subclass is provided specifically for representing menu structures. You can simply create an instance and populate it with menu choices for the user to select from.
This form only accepts tsc_MenuItem, tsc_UITaskMenuItem, tsc_SubMenuItem and tsc_SeparatorMenuItem controls.
Basic menu choices are represented by tsc_MenuItem controls and have no default click behaviour - you will need to either subclass the tsc_WizardMenu to handle clicks on these buttons or use tsc_CustomMenuItem derived classes instead. Unless you have custom requirements it is recommended that you do not use this control type.
tsc_UITaskMenuItems have behaviour linked to the UITask run code that they represent. The visibility of the resulting menu choice will automatically reflect the availability of the UITask at the time; the tsc_WizardMenu will launch this task for you when clicked.
Menu content
To build a more complicated menu structure you can also create submenus by nesting tsc_WizardMenu instances, use the tsc_SubMenuItem control to place a submenu in the wizard. The tsc_WizardMenu class will run the submenu on your behalf. Unlike tsc_WizardPage, ownership of the tsc_WizardMenu is not transferred but object lifespan should cover the duration of the ShowMenu call.
tsc_Control* Add (class tsc_MenuItem* control);
It is possible to retrieve and remove existing controls with
tsc_Control* Remove (tsc_Control* control);
tsc_Control* Remove (int index);
Retrieve the control from the menu. Ownership is retained by the menu.
tsc_Control* Get (int index);
Return how many items are on this menu - note this does not recurse. The count includes non-menu item controls.
int Count ();
Please note that:
You can access the tsc_SoftkeyControls this way in addition to the expected tsc_MenuItem (and derived) controls.
If you remove a control then you will be responsible for deleting it.
Displaying
Use the ShowMenu function to display your menu modally.
tsc_DialogResult ShowMenu();
You should probably only subclass to handle your own tsc_MenuItem controls in the OnClick method.
Example:
tsc_WizardMenu myMenu(X_MenuJob); myMenu.Add(new tsc_UITaskMenuItem(X_MenuJobNew)); myMenu.Add(new tsc_UITaskMenuItem(X_MenuJobOpen)); myMenu.Add(new tsc_UITaskMenuItem(X_MenuReviewCurrentJob)); myMenu.Add(new tsc_UITaskMenuItem(X_MenuPointManager)); myMenu.Add(new tsc_UITaskMenuItem(X_Map)); myMenu.Add(new tsc_UITaskMenuItem(X_MenuJobProperties)); myMenu.Add(new tsc_UITaskMenuItem(X_ImportFixedFormatFiles)); tsc_DialogResult result = myMenu.ShowMenu();