Chapter 2 85
Agilent VEE Programming Techniques
General Techniques
Lab 2-2: Creating a Dialog Box for User Input
If it is not already open, open the program usrobj-program3.vee.
In the
Data ⇒ Dialog Box submenu are six choices for dialog: Text
Input
, Int32 Input, and Real64 Input, as well as Message Box,
List Box, and File Name Selection boxes. In each case for text,
integer, and real input, a dialog box helps you configure the prompt or label,
default value, value constraints, and error message. Once you include one of
these dialog boxes, a pop-up input box will appear when the program is run.
1. Select
Data ⇒ Dialog Box ⇒ Int32 Input and place it to the left
of the
Function Generator. Change the Prompt/Label field to
Enter Frequency:. (Remember to click and drag over the field to
highlight it first.) Change the
Default Value to 100.
Tip: You can also double-click an input field to highlight an entry.
2. Change the
Value Constraints to 1 on the low end and to 193 on the
high end. Change the error message to reflect these new values, as shown
in Figure 2-6. Finally, iconize the
Int32 Input object.
Figure 2-6. The Int32 Input Configuration Box
3. Open the Object Menu for the Function Generator, and choose
Add Terminal ⇒ Data Input. In the dialog box for Select input
to add
, choose Frequency and click OK.
4. Connect the top output pin of the
Int32 Input object to the input pin
on the
Function Generator. Notice that Frequency can only be
changed through the input pin now, and you can no longer edit the
Frequency input field. The program should look like Figure 2-7.