Windows Controls & PowerBASIC
PowerBASIC allows any registered control to be added to a dialog by using the CONTROL ADD statement. But, with many of the Windows common controls PowerBASIC provides a variety of statements which simplify the job of the programmer in creating and modifying controls, as well as monitoring control events. These statements minimize the need for the programmer to work at the lower level of communication between control and dialog via the Control Send statement, or by manually extracting information from Windows messages.

The following list shows the 22 controls for which PowerBASIC provides special support.

Button Frame ImgButton ListBox   StatusBar
Check3State   Graphic   ImgButtonX   ListView TAB
Checkbox Image Label Option TextBox
ComboBox ImageX Line Progress Bar Toolbar
Scrollbar TreeView

Some PowerBASIC controls are actually derivations of the Windows Common Controls, so if you review the MSDN documentation you won't find every PowerBASIC control listed. Here's a list which maps derived PowerBASIC controls to the corresponding Windows common control.

In the following table, use the corresponding Windows common control data to get style/exstyle values for a PowerBASIC control.

Control Categories
The following categorized list of the supported controls will help understand the basic capabilities of the available controls.

Source code for creating each of these controls is discussed below. More detailed examples are provided on each of the specific control pages.

PowerBASIC CONTROL Statements
The various CONTROL statements, which include CONTROL ADD, provide most of the functions needed to create and manage child controls. As will be discussed below, there are also control-specific statements which supplement the CONTROL statements.

The starting point for creating controls and placing them on a dialog is is the CONTROL ADD statement. It defines the basic size/location and visual look of a control.

Other CONTROL statements are available to further manage controls, such as getting or setting control properties, as well as deleting or disabling the controls.

Here is a summary of all available CONTROL statements and a short description of the capabilities they provide.

Note that there are several versions of the CONTROL GET and CONTROL SET, corresponding the 20 different control properties they can access or set.

In addition to CONTROL statements, PowerBASIC provides statements that are specific to eight of the controls (ComboBox, ImageList, ListView, ProgressBar, Scrollbar, Statusbar, Toolbar, and TreeView). The control-specific statements are discussed on the individual control pages.

Finally, there are other PowerBASIC statements, such as FONT NEW, which can be used to modify how a control looks or behaves. These too are covered in the individual control pages.

CONTROL ADD Statements
The CONTROL ADD statement is used to create all controls. Fortunately, the syntax is the same for all of the controls, with only a few differences for controls which use images or which display lists.

Here's the syntax for the CONTROL ADD statement, along with a few specific examples.

    CONTROL ADD BUTTON, hDlg,id&,text$,x,y,xx,yy,style&,exstyle& CALL callback

    CONTROL ADD BUTTON, hDlg, 500&, "OK", 100,100,300,300
    CONTROL ADD CHECKBOX, hDlg, 501&, "Vote", 100,100, 300,300
    CONTROL ADD LABEL, hDlg, 502&, "Title", 100,100,300,300

The above examples demonstrate the minimum code needed to create a control - the handle of the parent dialog, a control ID, text content, upper/left coordinates and width/height.

And here is a description of each of the arguments.

The style&, exstyle& and CALL arguments are optional. The default values used when style&/exstyle& are omitted are listed further down this page, as is a full list of the style&/exstyle& values each control can use.

While the syntax above applies to all controls, there are some slight variations on the content of the arguments, depending on the control involved.

CONTROL Statements
In addition to the CONTROL ADD statement there are another 28 CONTROL statements that manage controls once they are created. A simple one-line description of each is provided below, followed by the syntax for using the statement.

And here is a description of the arguments for the CONTROL statements listed above. For each of the arguments, the CONTROL statements that apply are also listed.

Default Style& and ExStyle& Values
The style& and exstyle& arguments define the way a control looks, allowing the programmer a means of adjusting the controls visible features as needed in an application. Use of style& and exstyle& is optional on all controls. If not specified, the following default values are used by PowerBASIC.

Managing Controls - Style, ExStyle
Style and extended style values determine the visual look of a control. Microsoft documents the allowed values at its MSDN site.

I've pulled the information for the controls supported by PowerBASIC to create the following list of style and extended values for each control.

As noted earlier, some of the PowerBASIC controls are derivations of the Windows common controls. So, in the following table, use the corresponding Windows common control data to get style/exstyle values for a PowerBASIC control.


If you have any suggestions or corrections, please let me know.