[Tabmenu.Custom]Function.CreateDefaultMenu
- Last UpdatedJul 19, 2023
- 2 minute read
Sets your own function to create the default menu for the tab style templates.
Note: This parameter is available only to projects based on the Tab_Style templates.
This parameter is used to replace the built-in default menu and is effective only if the Menu Configuration form is blank. If there are items defined in the Menu Configuration form, the menu will be displayed according to the contents of the form.
Note that the INI parameter [Page]AddDefaultMenu determines items to be displayed on the tabbed menu bar. The default value of this parameter is 1 where the menu is populated as described earlier. However, if [Page]AddDefaultMenu=0 and a [Tabmenu.Custom]Function.CreateDefaultMenu is specified, the menu is populated based on the contents of the Menu Configuration settings, not the Cicode defined in [Tabmenu.Custom]Function.CreateDefaultMenu.
Setting [Page]AddDefaultMenu=2 and specifying a Cicode function in [Tabmenu.Custom]Function.CreateDefaultMenu, will result in merging items defined in Menu Configuration form to items populated via Cicode function.
Allowable Values:
Name of user defined function which conforms to the following specification:
Syntax
<function>(INT winNo)
winNo: The window number of the window where the menu is displayed
Default Value:
None
Return Value:
The menu node handle for the current window
Example
[Tabmenu.Custom]
Function.CreateDefaultMenu = MyDefaultMenu
INT FUNCTION MyDefaultMenu(INT winNo)
INT winNode = MenuGetWindowNode(winNo);
INT tabNode, childNode;
// Add Pages tab
tabNode = Tabmenu_AddChild(winNode, "Pages");
IF (tabNode >= 0) THEN
// Populate predefined pages
Tabmenu_AddChild(tabNode,"Page 1", "PageDisplay", "^"Page1^"");
Tabmenu_AddChild(tabNode,"Page 2", "PageDisplay", "^"Page2^"");
Tabmenu_AddChild(tabNode,"Page 3", "PageDisplay", "^"Page3^"");
END
// Add Alarms tab
tabNode = Tabmenu_AddChild(winNode, "Alarms");
IF (tabNode >= 0) THEN
// Populate alarm pages
Tabmenu_AddChild(tabNode, "Active Alarms", "PageAlarm", "");
Tabmenu_AddChild(tabNode, "Alarm Summary", "PageSummary", "");
Tabmenu_AddChild(tabNode, "Disabled Alarms", "PageDisabled", "");
Tabmenu_AddChild(tabNode, "Hardware Alarms", "PageHardware", "");
END
// Add Trends tab
tabNode = Tabmenu_AddChild(winNode, "Trends");
IF (tabNode >= 0) THEN
// Populate trend pages
Tabmenu_AddChild(tabNode, "Trends", "PageProcessAnalyst", "^"^",^"^"");
Tabmenu_AddChild(tabNode, "Trend Pop-up","ProcessAnalystPopup","^"^"");
END
// Add Tools tab
tabNode = Tabmenu_AddChild(winNode, "Tools");
IF (tabNode >= 0) THEN
// Populate administrative pages / commands
Tabmenu_AddChild(tabNode, "Log", "PageFile", "^"[DATA]:OperLog.txt^"");
childNode = Tabmenu_AddChild(tabNode, "Exit", "ShutdownForm", "");
MenuNodeSetProperty(childNode, 2, 8); // set privilege to 8
END
RETURN winNode;
END