Download LabWindows/CVI User Interface Reference Manual

Transcript
Chapter 3
Programming with the User Interface Library — Controlling a Graphical User Interface
The following rules apply when you assign constant names to menu bars in the User Interface
Editor:
•
You must assign a constant prefix to the menu bar. The prefix can be up to 10 characters
long and must be unique with respect to all other panel and menu bar prefixes that you
store together in a resource file. Your application program references the prefix to load
the menu bar from the resource file.
•
You can assign a constant prefix to each menu. The prefix can be up to 10 characters
long and must be unique with respect to all other menu prefixes in the same menu bar.
The program concatenates the constant prefix and the menu bar prefix to generate a
unique constant name. For example, if the menu bar prefix is MAIN and the menu prefix
is FILE, the complete constant name is MAIN_FILE. Your application program uses the
complete constant name to reference the menu.
•
You can assign a constant name to each menu item. Menu item constant names can be
up to 10 characters long and must be unique with respect to all other menu item constants
in the same menu. The program concatenates the menu bar prefix and the menu prefix
to generate a unique constant name. For example, if the menu bar prefix is MAIN, the
menu prefix is FILE, and the menu item name is OPEN, the complete constant name is
MAIN_FILE_OPEN. Your application program uses the complete constant name to
reference the menu item.
The User Interface Editor automatically inserts the constant name separator ( _ ) when it
generates the include file.
Note
When you use submenus, all identifiers starting with the menu bar prefix are
concatenated. Choose brief identifiers so that constant names remain as short as
possible.
Controlling a Graphical User Interface
Certain user operations on the GUI, such as selecting a menu item on the GUI or typing a
value, are called events. The User Interface Library provides the link between events and the
code files in your project.
User Interface Events
Your program can recognize events and execute the code in response to them. Table 3-1 shows
all of the events that are generated from the GUI and the information that is passed to your
program at event time.
LabWindows/CVI User Interface Reference Manual
3-4
© National Instruments Corporation