Create a new window

Note

Now you create a new window for the application. The window you create is a login window that allows the user to enter a user ID and password and connect to the database. The login window is a response window.

NoteAbout response windows Response windows are dialog boxes that require information from the user. Response windows are application modal. When a response window displays, it is the active window (it has focus) and no other window in the application is accessible until the user responds. The user can go to other applications, but when the user returns to the application, the response window is still active.

  1. Click the New button in the PowerBar.

    New button

    The New dialog box displays.

  2. Click the PB Object tab.

    Select the Window icon and click OK.

    Window icon

    The Window painter opens. Notice that you have two new toolbars, the StyleBar (with character style and text alignment buttons) and PainterBar3 (with color and border buttons, as well as grayed out control alignment buttons).

  3. Make sure that the Layout view and the Properties view display in the Window painter.

    You can display these views by selecting them from the View menu. If they are grayed out in the menu, the views are already displayed in the painter.

    The default view layout scheme contains both views.

    The rectangle in the Layout view represents the window you are building. The default properties in the Properties view indicate that the window is visible and enabled, and has the Main window type. You might need to scroll down in the Properties view to see the window type.

    Shown is the layout view.
  4. Type Welcome in the Title text box on the General page of the Properties view.

  5. Select response! in the Window Type drop-down list box.

    Make sure the TitleBar and ControlMenu check boxes are selected.

    Select the ContextHelp check box.

    The ContextHelp property adds a question-mark button next to the (ControlMenu) close button in the login window’s title bar. Users of your application can click the question-mark button to trigger Help events for the window controls. You can add a question-mark button to a response window, but not to a main window.

  6. Click the Other tab in the Properties view.

    Type 2300 in the Width text box and 1000 in the Height text box.

    Press the Tab key.

    The size of the window rectangle in the Layout view changes. The values you type are in PowerBuilder Units (PBUs). You might need to modify these values later, while you are adding controls to the window.

  7. Select File>Save from the menu bar.

    The Save Window dialog box displays. The only library in the Application Libraries text box is pbtutor.pbl, and it is selected.

  8. Type w_welcome for the window name.

    The prefix w_ is standard for windows.

    Shown is the Save window.
  9. (Optional) Type the following lines in the Comments text box:

    This is the login window. It requires the application user to enter an ID and a password before continuing.
    

    These comments are visible in the List view of the Library painter.

  10. Click OK.

    PowerBuilder saves the new login window. If you expand MyWorkspace, pbtutor, and pbtutor.pbl in the system tree, you can see w_welcome listed under it.