Modify window properties and add a retrieve call

Note

Now you modify the w_emplist_tutorial_main window properties to make the window easier to use.

  1. Click in the main window, but outside of the DataWindow control.

    In the Properties view, change the title from Main Window to Employees.

  2. Select the Close (OK) check box, if it is not already selected.

    Select the Show SIP Button check box.

    The Visible and Enabled window properties are selected by default. You select the Close (OK) property to give users a way to close the window. You select the Show SIP Button property so the Soft Input Panel (SIP) on the Pocket PC will be available to the user.

    Show are the Layout and Properties views of the Window painter. The Layout view shows a Data Window control with headers, and a Properties view with a menu name selected.
  3. In the main window’s Properties view, click the Scroll tab page.

    Select the HScrollBar check box and the VScrollBar check box.

    You add scrollbars to the window to give users a way to scroll to see data that is not visible in the window.

    Next you code the open event for the window.

  4. Select the “open” tab from the main stack of views.

    The label for the Script view tab shows the name of a default event. Typically the default event is an event that is already scripted. In this case, code has been added by the wizard to the window open and ue_postopen events when you generated the application, but “open” is the first event script that is run when the window is opened.

    Note that the only uncommented line in the open event calls the ue_postopen event.

  5. Select ue_postopen from the second drop-down list in the Script view.

    Uncomment the following two lines in the ue_postopen script:

    dw_1.SetTransObject(SQLCA)
    
    dw_1.Retrieve()
    

    You can uncomment the lines by removing the slash marks at the beginning of the lines.

    The code for the SetTransObject for DataWindow dw_1 associates the default SQLCA transaction object that is connected to the database with the DataWindow control.

    The Retrieve function call retrieves data from the database and populates the DataWindow object associated with the DataWindow control.

    You do not need to make any further changes to the ue_postopen script, since the DataWindow control that you added to the window is labeled dw_1 by default.

    Shown is the Script view for the main window open to the u e underscore post open event script. It has uncommented code to set the transaction object to S Q L C A and to retrieve the Data WIndow object in the d w 1 Data Window control.
  6. Click the Save button in the PainterBar or select File>Save from the menu bar.