Form
Description
The Form is the basic building block of your GUI application. It allows you to display a window or dialog box with controls for user interaction. Your GUI application can have one form or many forms.
Usage
Displaying a form A Form can be displayed in four ways:
If the Form is set as the startup form, then in auto mode when the system starts, it is displayed automatically. To set the startup form, right click on the form in the Forms Explorer, then select Startup Form, as shown below:
A form is shown in bold to indicate it is the startup form. You can also set the startup form for your project from Project | Properties | GUI Builder.
Using the GShowDialog function. This displays the form as a dialog box and returns the DialogResult value.
result = GShowDialog(frmSetSpeed)
Typically, the DialogResult value is set by buttons on the form, such as an OK button and a Cancel button.
Using the GShow statement. This displays the form as a window.
GShow frmIODiags
Select the form you want to execute from the drop down list in the Run window, and click [Start] button then the selected form will be displayed.
Setting Form Appearance
Set the FormBorderStyle property. For forms used as dialogs, you should use 3 – FixedDialog.
Set ControlBox, MaximizeBox, MinimizeBox to configure the form's title bar.
Set the WindowState to show the form as Normal size, Maximized, or Minimized when it is displayed.Using Help
You can display help topics from your own help file by setting the HelpButton property to True and the HelpID property to a topic ID in the help file.
For the details, refer to the following.
Using a Help File
Form Properties
Property | Description |
---|---|
AcceptButton | Sets the button control whose click event executes when the user types Enter. Default: None |
BackColor | Sets the background color for the form. Default: Control |
CancelButton | Sets the button control shoes click event executes when the user types Esc. After executed, the form closes. Default: None |
ControlBox | Sets whether the title bar control box items are displayed. Default: True |
Controls | Array of controls on the form. |
Count | Gets the number of controls in the Controls array. |
Dialog Result | Sets the return value when the form is closed (runtime only). |
EventTaskType | Sets the type of task used for events. Default: Normal |
FormBorderStyle | Sets the style of the border used for the form. Default: FixedDialog |
FormTemplate | Selects and sets the size of a form from the template. |
Height | Sets the height of the control in pixels. |
HelpButton | Sets whether the title bar help button is displayed. Default: False |
HelpID | Sets the ID for the help topic that is displayed when the user clicks the title bar help button Default: 0 |
Left | Sets the left coordinate of the form in pixels. |
MaximizeBox | Sets whether the title bar maximize button is displayed. Default: False |
MinimizeBox | Sets whether the title bar minimize button is displayed. Default: False |
Name | Sets the name of the control. |
StartPosition | Sets the start position of the form. Default: CenterScreen |
Text | Used to set the text of the control. Default: Name of form |
Top | Gets or sets the top coordinate of the form in pixels. |
Type | Gets the type name of the control. |
Width | Sets the width of the form in pixels. |
WindowState | Sets the default window state for the form. Default: Normal |
Form Events
Event | Description |
---|---|
Closed | Executes after the form is closed. |
Load | Executes when the form loads. |
Resize | Executes when the form is resized. |