Collection Contents Index Save the form Enhance the form pdf/chap7.pdf

First Guide to SQL Anywhere Studio
   PART 2. Getting Results with SQL Anywhere Studio
     CHAPTER 7. Creating Forms with InfoMaker       

Add buttons to the form


Now you will add three buttons to the form. Later when you run the form, you can click the buttons to add and delete contacts.

About controls    
The items you see on a form are called controls. For example, a button is a type of control.

The controls you can use on a form are listed in the Controls menu and are represented by buttons in the PainterBar. To see the list of controls, click Controls on the menu bar.

  1. Select Controls(CommandButton from the menu bar.

  2. Move the pointer to an empty area of the form and click.

    If you need to move the button, drag it.

    How to drag    
    Position the pointer over an object, and press and hold the left mouse button. While pressing the button, move the mouse until the object is where you want it. Then release the mouse button.

    A button with the text none displays. The text none also displays in a text box in the StyleBar.

    If the text box does not display    
    This means the button is not selected. To select the button, click it. Small black boxes in the corners indicate that it's selected.

  3. Make sure the button is still selected.

    Type Add a contact.

    The text displays on the button as you type and in the text box in the StyleBar.

  4. Click B (for bold) on the StyleBar.

    The text displays in bold. Next you will make the button work. To do this you will associate an InfoMaker action with the button.

    Using the StyleBar    
    You can use the StyleBar to change text fonts, font size, and style (bold, italic, and underline). You can also use it to specify text alignment (left-aligned, centered, and right-aligned).

    To use options on the StyleBar, you select a control with text and then click the appropriate button on the StyleBar.

  5. Move the pointer to the Add a contact button.

    Press the right mouse button to display the popup menu for the button.

    Select Action from the popup menu.

    The Select Action dialog box displays. It lists the actions you can assign to the button.

    About InfoMaker actions
        An action is what you want to happen when the button is clicked.

    Whenever you associate an InfoMaker action with a button, InfoMaker creates the code to enable the button to perform the action. You do not see the code. All you have to do is select the action for the button.

    InfoMaker comes with predefined actions. PowerBuilder users at your site can create additional actions, which will also display in the Select Action dialog box.

  6. Scroll through the list of actions and double-click Insert_Row.

    InfoMaker creates the code that enables your Add a contact button to display a blank form so you can add information for a new contact. You will see the button work later.

    Now you will add two more buttons.

  7. Select Controls(CommandButton from the menu bar.

    Move the pointer below the Add a contact button and click.

    Type Delete a contact.

    Display the Delete a contact button's popup menu and select Action.

    Select the action Delete_Row from the Select Action dialog box.

    Click OK.

  8. Select Controls(CommandButton from the menu bar.

    Move the pointer below the Delete a contact button and click.

    Type Save changes.

    Display the Save changes button's popup menu and select Action.

    Select the action Update_Row from the Select Action dialog box.

    Click OK.

    Now you have three buttons. InfoMaker has created the code that enables the buttons to work.


Collection Contents Index Save the form Enhance the form pdf/chap7.pdf