Reference: Using custom dialog boxes and controls

Once you have named a dialog box and given it a title, you can add controls to it. Each control is best suited for presenting or receiving a certain type of information. Most controls display a setting and allow you to change the setting.

Link commands perform dynamic actions in response to events. A link command can make a control do different things. For example, it can send a value to a cell in the notebook, send a value to another control, run a macro, close the dialog box, or change the zoom factor in the notebook. One control can have several link commands listed in the Object link dialog box.

The first list in the Object link dialog box (the Link event list) shows the event that you want to trigger the link command. More than one link command in a control can respond to the same event. The order in which the link commands display in the Object link dialog box is the order in which they run.


Understanding dialog box controls

Wordperfect Quattro Pro btnbacktotopproc Reference: Using custom dialog boxes and controls

The following table describes the most common controls.

Control
Description
Wordperfect Quattro Pro pgx ctpush Reference: Using custom dialog boxes and controls Button
Performs a specific action when clicked
Wordperfect Quattro Pro pgx ctckbox Reference: Using custom dialog boxes and controls Check box
Provides two choices: Yes when enabled and No when disabled
Wordperfect Quattro Pro pgx ctradio Reference: Using custom dialog boxes and controls Radio button
Typically used in a mutually exclusive list where only one radio button can be enabled at a time
Wordperfect Quattro Pro pgx ctgrpbx Reference: Using custom dialog boxes and controls Group box
Contains other controls, such as radio buttons or check boxes
Wordperfect Quattro Pro pgx ctlstbox Reference: Using custom dialog boxes and controls List box
Lets you choose data from a list
Wordperfect Quattro Pro pgx ctcombx Reference: Using custom dialog boxes and controls Combo box
Lets you add items to a list box
Wordperfect Quattro Pro pgx ctlabel Reference: Using custom dialog boxes and controls Label
Lets you display text next to a control
Wordperfect Quattro Pro pgx ctspin Reference: Using custom dialog boxes and controls Spin control
Lets you choose a value by typing or by clicking arrows and selecting a value
Wordperfect Quattro Pro pgx ctedfld Reference: Using custom dialog boxes and controls Edit box
Lets you type text
Wordperfect Quattro Pro pgx ctvscrll Reference: Using custom dialog boxes and controls Vertical scroll bar
Lets you select a value from a range of values
Wordperfect Quattro Pro pgx cthrzbar Reference: Using custom dialog boxes and controls Horizontal scroll bar
Lets you select a value from a range of values
Wordperfect Quattro Pro pgx ctbitmap Reference: Using custom dialog boxes and controls Bitmap button
Lets you display a bitmap image instead of a label on a button, and then imitates the behavior of a check box, radio button, or push button
Wordperfect Quattro Pro pgx ctrectc Reference: Using custom dialog boxes and controls Rectangle control
Embellishes a dialog box, or groups two or more controls
Wordperfect Quattro Pro pgx ctfile Reference: Using custom dialog boxes and controls File control
Lets you choose a filename and a browse button with access to all available files
Wordperfect Quattro Pro pgx ctcolor Reference: Using custom dialog boxes and controls Color control
Lets you change a color setting
Wordperfect Quattro Pro pgx cttab Reference: Using custom dialog boxes and controls Tab
Let
s you create tabs on a dialog box
Wordperfect Quattro Pro pgx cttimer Reference: Using custom dialog boxes and controls Timer control
Lets you add a timer, clock, or alarm to a dialog box

For more information about the functions of controls, see “Properties of dialog box controls.”


Examples of linking controls

Wordperfect Quattro Pro btnbacktotopproc Reference: Using custom dialog boxes and controls

You can create dialog boxes and forms with a variety of controls. You must link each control to an action before it can perform a task. For example, you can write a link command for a button that displays another dialog box when clicked.


Linking bitmap buttons

The following examples give you an idea of the items you can select from the events list, the link commands list, and the other lists in the Object Link dialog box.

Example 1: Displays the dialog box named Warning2 when the button is clicked.

List
Choose
On
ON
Link Events
Clicked
Link Command
EXECUTE
Object Selector list
Warning2
Selected object Properties
Execute

Example 2: Hides the button named BitmapButton1 when the dialog box initially displays.

List
Choose
On
ON
Link Events
Init
Link Command
SET
Link Control Properties
Yes TO
Object Selector
BitmapButton1
Selected Object Properties
Hidden


Linking push buttons

A push button runs a specified command when clicked by the user.

Example: Makes the list box named ListBox6 run any link commands attached to it that respond to the event trigger.

List
Choose
On
ON
Link Events
Clicked
Link Command
TRIGGER
Object Selector
ListBox6
Selected Object Properties
Trigger


Linking check boxes

Example: Sets the text appearing by the check box button when the dialog box initially displays. The text is taken from the cell A:C23.

List
Choose
On
ON
Link Events
Init
Link Command
RECEIVE
Link Control Properties
Label_Text FROM
Object Selector
A:C23
Selected Object Properties
Value


Linking combo boxes

By default, a drop-down list is created that has an edit field where users can enter information, or they click the down arrow and choose an option from the list.

Example: Sets the typeface of the label named Label5 as the user scrolls through the combo box’s list of items.

List
Choose
On
ON
Link Events
ValueChanged
Link Command
SEND
Link Control Properties
Value TO
Selected Object
Label5
Selected Object Properties
Label_Font.TypeFace


Linking edit fields

Example 1: Displays the point size of the active cells (or cell). This link command is triggered by another link command (see Link timer controls for an example of a link command that does this).

List
Choose
On
ON
Link Events
Init
Link Command
RECEIVE
Link Control Properties
Value FROM
Selected Object
A:A1
Selected Object Properties
Value

Example 2: As the user types text into the edit field, the text is copied into the active cell and stored there as a label (using the String_Value property).

List
Choose
On
ON
Link Events
Valuechanged
Link Command
SEND
Linked Control Properties
Value TO
Selected Object
A:A1
Selected Object Properties
String_Value

Example 3: When the user types text into the edit field and presses ENTER, the text is entered into the active cell exactly as it was typed by the user.

List
Choose
On
ON
Link Events
Enter
Link Commands
SEND
Linked Control Properties
Value TO
Selected Object
A:B1
Selected Object Properties
Value

Example 4: Sends the edit field’s value to A:A34 whenever the user presses ENTER. Using Number_Value ensures that the entry is always stored as a value.

List
Choose
On
ON
Link Events
Enter
Link Commands
SEND
Link Control Properties
Value TO
Selected Object
A:A34
Selected Object Properties
Number_Value

Example 5: If the edit field is named EditInteger3, this link command sets the edit field’s maximum acceptable value to the current value whenever the user presses ENTER. This is handy for setting up an edit field that has no maximum value, but still has a minimum value (set by the Minimum property).

List
Choose
On
ON
Link Events
Enter
Link Command
SEND
Link Control Properties
Value TO
Selected Object
EditInteger3
Selected Object Properties
Maximum


Linking file controls

Example 1: Sets the initial wildcard displayed by the file select control named FileCtrl6. All files with the extension .bdg are displayed.

List
Control
On
ON
Link Events
Init
Link Commands
SET
Linked Control Properties
*.BDG TO
Selected Object
FileCtrl6
Selected Object Properties
Value

Example 2: Sets the initial directory displayed by the file select control named FileCtrl6 to FILES on the C: drive.

List
Choose
On
ON
Link Events
Init
Link Commands
SET
Linked Control Properties
C:\FILES\ TO
Selected Object
FileCtrl6
Selected Object Properties
Value


Linking group boxes

Example: Sets the text of the label named Label5 whenever a different radio button in the group box is chosen.

List
Choose
On
ON
Link Events
Valuechanged
Link Commands
SEND
Linked Control Properties
Value TO
Selected Object
Label5
Selected Object Properties
Label_Text


Linking scroll bars

Example 1 (Horizontal scroller link): Sets the active cell to the scroll bar’s value.

List
Choose
On
ON
Link Events
Valuechanged
Link Commands
SEND
Link Control Properties
Value TO
Selected Object
A:A1
Selected Object Properties
Value

Example 2 (Horizontal scroller link): Sets the initial value of the scroll bar to the value stored in A:C67.

List
Choose
On
ON
Link Events
Init
Link Commands
RECEIVE
Linked Control Properties
Value FROM
Selected Object
A:C67
Selected Object Properties
Value

Example 3 (Vertical scroller link): Sets the text color of the active cell (or cells) whenever the scroll bar’s value is changed. Make sure the scroll bar is restricted to the range 0 through 15.

List
Choose
On
ON
Link Events
Valuechanged
Link Commands
SEND
Linked Control
Properties
Value TO
Selected Object
A:A12
Selected Object Properties
Text_Color


Linking list boxes

Example 1: Sets the list displayed to the cells stored as a label in cell A:A25 when the dialog box initially displays.

List
Choose
On
ON
Link Events
Init
Link Commands
RECEIVE
Linked Control Properties
List FROM
Selected Object
A:A25
Selected Object Properties
Value

Example 2: Sets the list displayed to the cells stored as a label in cell A:A25 when another control uses the link command TRIGGER to generate the trigger event.

List
Choose
On
ON
Link Events
Trigger
Link Command
RECEIVE
Link Control Properties
List FROM
Selected Object
A:A25
Selected Object Properties
Value

Example 3: Sets the title of the pick list button named PickList5 to Blocks when the dialog box initially displays.

List
Choose
On
ON
Link Events
Init
Link Commands
SET
Linked Control Properties
Blocks TO
Selected Object
PickList5
Selected Object Properties
Label_Text


Linking radio buttons

Example 1: Displays the message stored in the cells A:A1..C3 whenever the radio button is selected by the user.

List
Choose
On
ON
Link Events
Activate
Link Commands
DOMACRO
Selected Object
{MESSAGE A:A1..C3,0,0,0}

Example 2: Sets the initial text appearing by the radio button to whatever is stored in cell A:C3.

List
Choose
On
ON
Link Events
Init
Link Commands
RECEIVE
Link Control Properties
Label_Text FROM
Selected Object
A:C3
Selected Object Properties
Value


Linking spin controls

Example 1: Sets the shading blend of the active cell or cells. Make sure the spin control is restricted to the range 0 through 6.

List
Choose
On
ON
Link Events
Valuechanged
Link Command
SEND
Link Control Properties
Value TO
Selected Object
A:A1
Selected Object Properties
Value

Example 2: Sets the height of the rectangle named Rectangle2 whenever the spin control’s value changes.

List
Choose
On
ON
Link Events
Valuechanged
Link Commands
SEND
Link Control Properties
Value TO
Selected Object
Rectangle2
Selected Object Properties
Dimension.Height


Linking timer controls

Example 1: Tells the edit field named EditField6 to run any link commands attached to it that respond to the event trigger. Use this to create edit fields that constantly retrieve settings from the active object (cells, notebook, sheet, and so on).

List
Choose
On
ON
Link Events
Timer
Link Commands
TRIGGER
Selected Object
EditField6
Selected Object Properties
Trigger

Example 2: Displays a message stored in the cells A:A1..C3 when the time specified in the timer control’s Alarm Time property is reached.

List
Choose
On
ON
Link Events
Alarm
Link Command
DOMACRO
Selected Object
{MESSAGE A:A1..C3,0,0,0}

Understanding link commands

Wordperfect Quattro Pro btnbacktotopproc Reference: Using custom dialog boxes and controls

The following table shows you the link commands available from the Link command list:

Choose
Result
SEND
Sends a value or property to a cell in the notebook; another control; or a property in a selection; sheet; notebook; or the Quattro Pro application
RECEIVE
Receives a value or property from a cell in the notebook, another control, or a property in a selection, sheet, notebook, or the Quattro Pro application
DOMACRO
Plays the macro you specify
EXECUTE
Executes another control or another dialog box
SET
Sets properties in the dialog box, another dialog box, a cell, a sheet, a notebook, or the Quattro Pro application
TRIGGER
Executes or “fires” an action or piece of code when certain events or conditions are met. For example, you might use a trigger event for a button that updates values.
IF
Creates conditional statements

The {DODIALOG} macro command brings changed values to the notebook when you close the dialog box. However, if you set up a dynamic link, you do not have to close the dialog box to see the changed values. For more information about using {DODIALOG}, see “Using macros to display a dialog box.”


Understanding link events

Wordperfect Quattro Pro btnbacktotopproc Reference: Using custom dialog boxes and controls

The following table describes the link events common to all dialog box controls.

Link event
Triggers the link command when
Init
The dialog box is about to display. Use Init to set initial settings.
Init_Complete
You add a link command to the dialog box itself. This event occurs immediately after all controls have run all link commands that respond to Init.
OKExit
The dialog box has been closed. The link command runs before the dialog box closes.
CancelExit
The dialog box has been canceled. The link command runs before the dialog box closes.
Clicked
The control has been clicked..
Right_bdown
The control has been right-clicked.
Left_bdown
You’ve pointed to the control and held down the left mouse button. Releasing the button generates a Clicked event.
Doubleclick
The control has been double-clicked.
Valuechanged
The value of the control has been changed. This event occurs any time the value is changed.
key:keystroke
The key keystroke has been pressed. When you choose key from the Link event list, it flashes to indicate that you must press a key. Press the key you want to generate the event. For example, key:Ctrl + F5 indicates that the link command is triggered by pressing Ctrl + F5.
Activate
The control for manipulation has been chosen. For example, clicking an edit box generates this event so that Valuechanged traps the final result entered in the edit box.
Deactivate
Another control has been chosen, leaving this control inactive.
Trigger
This event cannot be generated by any action. Use it to connect link commands that are triggered (or executed) by link commands. Use the link command TRIGGER to generate this event.

Some link events that trigger link commands are available only for specific controls. The following table describes link events for edit boxes, scroll bars, combo boxes, and timer controls.

Control
Link event and purpose
Edit box
Enter — executes when Enter is pressed.
Scroll bars
Lineup — permits you to increase the value of the scroll bar by clicking a scroll arrow
 
Linedown — permits you to decrease the value of the scroll bar by clicking a scroll arrow
 
Pageup — permits you to increase the scroll bar’s value by clicking between a scroll arrow and the scroll box
 
Pagedown — permits you to decrease the scroll bar’s value by clicking it between a scroll arrow and the scroll box
 
Thumb — lets you click or drag the scroll bar’s scroll box
Combo box
Editdynamic — lets you insert or delete characters in the combo box’s edit box
Timer control
Alarm — executes when the specified time has been reached
 
Timer — executes when the specified amount of time has elapsed

Outline of control-specific properties

Wordperfect Quattro Pro btnbacktotopproc Reference: Using custom dialog boxes and controls

You can assign properties to a control by right-clicking it, and clicking Properties. The commands on the Properties menu listed before Dimension are specific to that control. All the properties from Dimension to the end of the menu are properties you can set for all controls. The procedure for assigning these properties differs from control to control. The following list identifies control-specific properties.

For more information about specific controls, see “Adding dialog box controls.”


Bitmap button properties

You can select a bitmap image from the systems list or display a bitmap image you have available from another source by using the Bitmap properties dialog box. You can also assign a bitmap button a behavioral identity from the Button type properties.


Push button properties

A push button can also imitate the behavior of an OK button or a Cancel button, allowing the button to close the dialog box.


Check box properties

You have the option of displaying a check box label to the left of a check box in addition to the default display (which displays the label on the right side.)


Combo box properties

One of the variations possible is to configure the combo box to prevent you from entering a value into the list. By default, combo box entries are sorted alphanumerically in ascending order. A combo box can also be set to display a history as the list of the combo box.


Label control properties

You can use the default font in a label control, or you can change the label font through the Label font properties. You can also change the word wrap features of the label and position of the text on the label.


Edit box properties

The input data can be characters, numbers, cell addresses, or you can make the typed data hidden. When you specify Integer as the field type, the control is renamed to Edit Integer. Default values for Edit Integer are 0 as the minimum value, 32,676 as the maximum value, and 0 as the initial (default) value in the edit box. You can configure the edit box to accept special characters, using the following chart for characters available:

Special character
Result
\n
Displays the following text on a new line
\t
Inserts a tab
\\
Inserts a backslash (\) into the text

You can set an edit box so that you can double-click the edit box, and point to a cell or cell block on a spreadsheet to add the cell references to the edit box.


File control properties

You can display a predefined list in the File list control. When you click the Browse button, the Quattro Pro open file dialog box displays. If the Dialog type property is set to Save, the Quattro Pro save file dialog displays. You can also prevent users from typing in the box.


Group box properties

When a group box contains radio buttons, its value is the title of the radio button chosen. By default, an empty group box does not have a value. A group box has a Value property and a Selected property. The Selected property indicates numerically which of its radio buttons is enabled, starting from the top-left radio button (zero) and proceeding to the bottom-right button.

When you create a group box, the Process value of a group box is set to Yes. The Process value of radio buttons in the group box are set to No.


Scroll bar properties

You can configure a scroll bar by setting parameters and changing the settings.


List box properties

You can use a predefined list or assign data in a cell block as the list in a list box. By default, the list displays with one column, but you can add more columns to a list box. By default, lists display in alphanumeric order.


Radio button properties

You can change the label of a radio button, as well as display the label on either the right (default) or left sides of the radio button.


Rectangle control properties

You can customize the appearance of the rectangle through the Rectangle control properties. The Transparent rectangle style is useful for grouping controls together without displaying the rectangle to which they are attached. The background color and the border color around the rectangle can also be customized.


Spin control properties

You can assign a range of values to a spin control through the spin control properties. You can also change the number of digits allowed to display by adjusting the integer length (the default length is 6).


Tab control properties

Once you add a tab control to a dialog box, you can then create multiple tabs (or pages) to help organize the dialog box controls. The Active page property indicates which tab is active. The Page list property displays commands for creating, removing, and reordering tabs.


Timer control properties

There are two ways to configure a timer control for generating regular events: as a timer or as an alarm.

A timer generates the timer event at regular intervals (for example, every two seconds). A timer control shows the current time. You can also use a timer control to run link commands at regular intervals or at a certain time. You can use timer controls to display the current time in a dialog box or on a toolbar. Timer controls do not have a value.

Two properties of the timer control are used to specify the number of milliseconds to wait between timer events, as shown in the following formula: Wait = Units in Milliseconds X Interval in Units

Units in Milliseconds is set to 1000 by default, so you can use the Interval in units property to specify how many seconds to wait between timer events.

As an alarm, the timer control generates the alarm event at a certain time. The toolbar must be open; for example, an alarm set for 3:00 will not generate an alarm event if the toolbar is not on screen at 3:00.


Example of using macros to display a dialog box

Wordperfect Quattro Pro btnbacktotopproc Reference: Using custom dialog boxes and controls

First, set up an area in the notebook that will send default settings to the dialog box. For example, in the following table for a loan payment dialog box, B1..B5 is a block that defines the initial dialog box settings:

A
B
1. Pay_Every
Month
2. Loan_Amount
100000
3. Int_Rate
12.5
4. Term
30
5. End_Of_Period
No

This sets the default payment period to monthly, the default loan amount at 100,000, the default interest rate at 12.5%, the default term at 30 years, and the payment date at the start of the month.

After the initial dialog box settings have been entered in the notebook, you can enter a macro command that will display the dialog box and send the choices back to the notebook. Use the {DODIALOG} command to do this.

Each cell in the block (starting at the upper-left cell and proceeding row by row to the lower-right cell) sets the initial value of one control. If the dialog box is cancelled, the values in this block remain unchanged.

Here is an example of a {DODIALOG} macro command used to display a loan payment dialog box using the initial settings in B1..B5: {DODIALOG LoanData,B6,B1..B5,1}

This command displays the dialog box and sends (or passes) the initial values in cells B1 through B5 to the dialog box controls. If the dialog box is cancelled, it also sends a value of 0 to cell B6 ; otherwise, the value is 1. The final argument of the command specifies that you can manipulate the dialog box.

For example, if a dialog box has six controls, but you have set the Process value property of the third control to No, the setting block should be only five cells long. The values in the first two cells will be passed to the first two controls. However, the value in the third cell will go to the fourth control, and the values in the fourth and fifth cells will go to the fifth and sixth controls, respectively.

Setting the Process value property to Yes lets the {DODIALOG} macro command access the control’s value. The Process value property is available for many dialog box controls.

By default, the order in which you created controls is the order that the {DODIALOG} command sets initial values in a dialog box. The first control you created is sent the first value from the {DODIALOG} command, regardless of its position in the dialog box.

You can make this dialog box dynamic by adding link commands to each control so that the changes are immediately reflected in the notebook. For more information about using link commands, see “Attaching actions to dialog box controls.”

Reference: Using custom dialog boxes and controls