Managing Menu Bars in a LabWindows/CVI User Interface
- Updated2025-07-23
- 1 minute(s) read
The TestStand Utility Functions provide the following set of functions for creating and handling TestStand-specific menu items without requiring any additional code:
- TS_InsertCommandsInMenu
- TS_RemoveMenuCommands
- TS_CleanupMenu
Use the TS_InsertCommandsInMenu function to create new menu items that execute commands you specify. To create menu items, you specify an array of command types, and the menu bar and menu IDs determine where to insert the commands. Each command type specifies a menu item or group of menu items to insert. You must also specify a handle to the Application Manager control, ExecutionView Manager control, or SequenceFileView Manager control to which the new menu items apply. TestStand uses a manager control to determine whether the menu item is visible or dimmed. TestStand installs a callback sequence for each menu item that automatically invokes the associated command when the user selects the menu item.
Call the TS_InsertCommandsInMenu function when the application rebuilds the menu bar in a MenuDimmerCallback function to populate the menu bar with commands that apply to the current state of the application. Before you call this function, you can call TS_RemoveMenuCommands to remove any menu items you previously inserted.
Refer to the RebuildMenuBar function in the <TestStand Public>\UserInterfaces\Full-Featured\CVI\Source Code\TestExec.c source file for an example of rebuilding the menu bar.