Click or drag to resize

Command bar

Overview

For the end-user the command bar is a central FlexPendant control and an important means of interacting with the system. As described in How to build the command bar it can be ready-made or added to the container control from the Visual Studio Toolbox.

How to add menu items

If you use the Form container a command bar is built-in, but not visible until you add a MenuItem collection to the MainMenu property of TpsForm . How to do this is shown in step 5 - 6 of Hands on - step 2.

If you use Empty as container the command bar needs to be added from the Toolbox. In this case too, the commands are added as a collection of menu items.

6.3.4 1 Cmd Bar 2nd View

The command bar in this figure has a collection of three menu items: Launch View, Close View and Close. Moreover, the Launch View menu item has its own collection of menu items: Rapid Data , Jogging and Backup Restore.

In the figure, as shown by the task bar, the Backup Restore view has been opened. It has been done by clicking the Backup Restore menu item. The user has then returned to the Hello World application by using the task bar. If Close View is now pressed, the Backup Restore view will close down. The next section shows how event handlers for this command bar can be implemented.

How to add menu item event handling

Subscriptions to menu item events and event handling cannot be added using the design support, but have to be implemented by hand in the source file. The following code example shows how the command bar in the preceding figure can be implemented.

menu item code
Note Note

To launch a standard view the ITpsViewLaunchServices object, which can be saved by the TpsView class in its Install method, is needed. For more information, see Using launch service.