Winform

In this section:

How to:

Reference:

The Winform command controls the forms that appear on the screen. Winforms are used to edit and display data. They act as an application's user interface, whereas a procedure controls the application's logic and use of data.


Top of page

x
Syntax: How to Use the Winform Command

The Winform command performs three tasks:

The syntax of the Winform command for displaying and controlling forms is

Winform command formname [;]

where command is one of the following:

Show

Makes the specified form active: it displays the form and transfers control to it, enabling an application user to manipulate the controls (of the form), such as buttons and fields. If other forms are currently displayed on the screen, the specified form is displayed on top.

Show_Active

Can be used for clarity. It is functionally identical to Show.

Show_Inactive

Displaysthe specified form without making it active. Because the form is inactive, control passes to the following command, not to the form. You can use this to change the initial properties of a form, and of the form's controls, dynamically at run time before the form is displayed.

Refresh

Repopulates the form's data values as if control had returned to the form from a trigger, but without making the form active.

Close_All

Closes all forms. The form environment remains active.

Close

Closes the chain of forms from the currently active form back up to the specified form. If you do not specify a form, the command closes only the currently active form.

The close operation does the following:

  • Passes control directly to the beginning of the chain, to the point just following the Winform Show command that called the specified form.
  • Removes closed popup forms from the screen. Closed non-popup Winforms remain on the screen until hidden by a Winform Hide command or the end of the current Maintain procedure.
Stop

Closes all Winforms. Terminates the Winform environment. Directs TYPE messages to the screen.

The syntax of the Winform command for changing a form control property is:

Winform Set formname[.controlname].property TO value [;]

The syntax of the Winform command for querying a form control property is

Winform Get formname[.controlname].property INTO variable [;]

where:

formname

Is the name of the form.

controlname

Is the name of the form control whose property you wish to set or get. Omit the control name if you are changing a property for an entire form, otherwise you must specify it.

Except where noted otherwise in Dynamically Changing Winform Control Properties, properties can be set for all types of controls.

property

Is any valid property. Properties are described in Dynamically Changing Winform Control Properties.

value

Is a value that is valid for the specified property. Properties and their values are described in Dynamically Changing Winform Control Properties.

variable

Is any scalar variable (a user-defined field or a stack cell) to which you will assign the value of the specified property of the specified form or control.

;

Terminates the command. Although the semicolon is optional, including it to allow for flexible syntax and better processing is recommended. For more information about the semicolon, see Terminating a Command's Syntax.


Top of page

x
Reference: Commands Related to Winform

Top of page

x
Managing the Flow of Control in a Winform

When a Winform command is encountered that contains the Show option, control is passed to the named Winform. Control does not return to the procedure until the user exits the Winform. While the Winform is active, controls within the Winform can call Maintain functions (controls are also known as Winform objects, and functions are also known as cases). This is accomplished by the use of triggers that specify what happens when the associated event occurs.

The following is an example of a triggered Maintain function. Two Winforms are hidden, a background Winform is displayed, and the main Winform is made active. The background Winform is just a background graphic, so there is no need to activate it:

Winform Hide Addr;
Winform Hide Info;
Winform Show_Inactive Back;
Winform Show_Active Main;

The next example uses the Winform command after a MATCH in a triggered function. If there is a match on Emp_ID, two Winform commands are performed. Empinput, the Winform used to enter the employee’s ID number, is hidden and EmpInfo, the Winform that displays information for the employee whose ID was found, is activated. If the MATCH is unsuccessful, the procedure displays the NotFound Winform which informs the application user that the employee ID was not found. It does not hide the Empinput Winform because the application’s user should be able to see the unsuccessful employee ID in case the error was caused by a typing mistake:

CASE Findemp
MATCH Emp_ID;
ON MATCH BEGIN
  Winform Hide Empinput;
  Winform Show EmpInfo;
ENDBEGIN
ON NOMATCH Winform Show Notfound;
ENDCASE

A trigger action can be a case (also known as a function) or a system action (such as Exit).

When a trigger that specifies a function is called, the function is performed. The Winform remains visible to the end user but does not accept keyboard activity. When the function or functions finish processing, the Winform again becomes available to end user activity.

A trigger can display another Winform. This is done by specifying a Winform command within the triggered Maintain function. In this situation, if the Winform in the function is made active by the Show or Show_Active option, the Winform that triggers the function continues to be displayed but is no longer active. When the second Winform is exited, control returns to the function that called it. When that function is exited, control returns to the Winform from which the trigger was called, and at that time the calling Winform becomes active again. The following are the steps in a generic example:

  1. Winform A is active, and the user invokes a trigger.
  2. The trigger calls a function.
  3. The function displays Winform B and makes B active. Winform A is no longer active.
  4. Once Winform B is exited, the rest of the function is performed.
  5. When the function is exited, Winform A becomes active again.

In this example, if Winform B has a trigger that issues a Winform Show A command, a warning message is displayed because Show cannot be specified for a Winform that is already displayed to the user.


Top of page

x
Displaying Default Values in a Winform

If a form displays a variable that has not been assigned a value, the form will display the default value. A variable's default is determined by its data type and whether it was defined with the MISSING attribute:

Data Type

Default value without the MISSING attribute

Default value with the MISSING attribute

Character/Alphanumeric

space

null

Numeric

zero

null

Date and time

space

null

A null value is displayed as a period (.) by default; you can specify a different character using the SET NODATA command.



x
Dynamically Changing Winform Control Properties

You can change many properties of forms and controls at run time using the Winform Set command, and can determine the current state of those properties using the Winform Get command. Controls are also known as Winform objects. You can use these commands with all Winform controls. For some properties, such as a grid’s current column, you call a function instead of using Winform Set and Get.

If you want to change a form's properties at run time before the form is displayed, you can first issue the Winform Show_Inactive command, then issue commands to set form and control properties, and finally issue a Winform Show command. If you wish to change a form's properties in response to user activity in the form, you can trigger a function containing Winform Set commands and function calls from those user events. You cannot dynamically set a form's properties before it has been opened with either a Winform Show or Winform Show_Inactive.

For example, you could develop a data entry function that determines whether a user has entered data into a field; if the user has not, you could use the Winform Set command to change the field's color and give it focus, effectively drawing the user's attention to it and making it the target of any keyboard activity.

You can set and query the following properties:


Information Builders