You create DataWindow objects using a wizard, and then enhance them in the DataWindow painter.
To create a DataWindow object:
In the Solution Explorer, right-click DWStart.pbl and select Add New Entry from the pop-up menu.
In the Add New Entry dialog box, select DataWindow Object from the categories list, select Tabular from the list of templates, enter d_custlist as the name, and click Add.
The Choose Data Source for Tabular DataWindow page of the DataWindow wizard displays.
Select Quick Select as the data source, select the Retrieve On Preview check box if it is not already selected, and click Next.
The Quick Select dialog box displays.
Click the customer table in the Tables list box.
This opens the table and lists its columns as shown in the illustration below. For this DataWindow, you will select four columns.
Click id, fname, and lname in the Columns list box in the order listed.
Scroll down the list and click company_name.
DataWindow Designer displays the selected columns in a grid at the bottom of the Quick Select dialog box.
Selection order determines default display order
The order in which you select the columns determines their
default left-to-right display order in the DataWindow
object. If
you clicked a column by mistake, you can click it again to clear
the selection. You can also rearrange columns later in the DataWindow
painter.
You can use the grid area at the bottom of the dialog box to specify sort criteria (for the SQL ORDER BY clause) and selection criteria (for the SQL WHERE clause).
In the grid area of the Quick Select dialog box, click in the cell next to Sort and below Id.
A drop-down list displays.
Select Ascending from the drop-down list.
This specifies that the id column is to be sorted in ascending order.
Click OK.
The DataWindow wizard asks you to select the colors and borders for the new DataWindow object. By default, there are no borders for text or for columns.
Click Next.
This accepts the border and color defaults. The DataWindow wizard summarizes your selections.
Click Finish.
DataWindow Designer creates the new DataWindow object and opens the DataWindow painter.
The Design view in the DataWindow painter is divided into four areas called bands: header, detail, summary, and footer. You can modify the contents of these bands. For example, you can change their sizes, add objects (controls, text, lines, boxes, or ovals), and change colors and fonts.
In the Design view, DataWindow Designer displays a Heading band with default headings and a Detail band with the columns you selected:
The Preview view displays the DataWindow as it appears at runtime. DataWindow Designer displays data for all customers. The data is sorted in ascending order by customer ID, as you specified in the wizard.