Working with the DataWindow control in PocketBuilder

Inserting a DataWindow control

To use the DataWindow object in an application, you add a DataWindow control to a window, then associate that control with the DataWindow object.

Figure 9-1: DataWindow control before association with an object

In the untitled window, a field of dots displays as a background grid  in the Layout view. This is because the Show Grid option is selected in the window’s Design options dialog box. A blank rectangle superimposed on the grid represents the DataWindow control. The four corners of the control are small black rectangular handles for resizing the control.

StepsTo place a DataWindow control in a window or custom visual user object:

  1. Open the window or user object that will contain the DataWindow control.

  2. Select Insert>Control>DataWindow from the menu bar.

  3. Click where you want the control to display.

    PocketBuilder places an empty DataWindow control in the window.

  4. (Optional) Resize the DataWindow control by selecting it and dragging one of the handles, or changing its position properties on the Other page of the Properties view.

Specifying a DataWindow object

After placing the DataWindow control, you associate a DataWindow object with the control.

StepsTo associate a DataWindow object with the control:

  1. In the DataWindow Properties view, click the Browse button for the DataObject property.

  2. Select the DataWindow object that you want to place in the control and click OK.

    The name of the DataWindow object displays in the DataObject box in the DataWindow Properties view.

  3. (Optional) Change the properties of the DataWindow control as needed.

    NoteAllowing users to move DataWindow controls If you want users to be able to move a DataWindow control at runtime, give it a title and select the Title Bar check box. Then users can move the control by dragging the title bar.

Defining reusable DataWindow controls

You might want all the DataWindow controls in your application to have similar appearance and behavior. For example, you might want all of them to do the same error handling.

To be able to define these behaviors once and reuse them in each window, you create a standard visual user object based on the DataWindow control. Define the user object's properties and write scripts that perform the generic processing you want, such as error handling. Then place the user object (instead of a new DataWindow control) in the window. The DataWindow user object has all the desired functionality predefined. You do not need to specify it again.

For more information about creating and using user objects, see the User's Guide.

Editing the DataWindow object in the control

Once you have associated a DataWindow object with a DataWindow control in a window, you can go directly to the DataWindow painter to edit the associated DataWindow object.

StepsTo edit an associated DataWindow object:

  1. Select Modify DataWindow from the DataWindow control's pop-up menu.

    PocketBuilder opens the associated DataWindow object in the DataWindow painter.