ContentsIndexPreviousNext

STYLES

DEFAULT-BUTTON This style indicates that this button is the default push button. The user can push (activate) the default button by typing a termination key that has a termination code of "13". Under the default runtime configuration, this is the "Return" (or "Enter") key. When this occurs, the runtime generates a button pushed event instead of the normal termination event. This ensures that the program treats the "Return" key and the default push button in the same manner (since they both generate the same event). See the TERMINATION-VALUE property described below for related information.

Push buttons with the DEFAULT-BUTTON style are typically displayed differently by the host system. Under Microsoft Windows, default push buttons have a thicker border. Only one button should have the DEFAULT-BUTTON style at any one time. If more than one button has the DEFAULT-BUTTON style, the meaning is ambiguous. Note that the DEFAULT-BUTTON style is implied by the OK-BUTTON style.

ESCAPE-BUTTON Similar to the DEFAULT-BUTTON style, this style indicates that the push button corresponds to the "Escape" key. The user can push this button by typing a key that has an exception value of "27" (i.e., the "Escape" key in the default configuration). When this occurs, the runtime generates a button pushed event instead of the normal exception event. This ensures that your program handles the "Escape" key and the escape button in the same manner. Note that only one enabled button should have the ESCAPE-BUTTON style at any one time. See the EXCEPTION-VALUE property below for related information.

NO-AUTO-DEFAULT Normally, when a push button is activated, it becomes the default push button. The runtime accomplishes this by giving the DEFAULT-BUTTON style to the activated push button and removing it from any other push button in the same floating window. This allows the user to type the "Return" key to push the active button. If you specify NO-AUTO-DEFAULT, then this behavior is not applied when this button is made active. The default push button, if any, remains unchanged.

SELF-ACT Normally, when the user clicks on a button with the mouse, the mouse requests that it be activated by sending a CMD-GOTO event to your program (see Chapter 6, "Events Reference"). After being activated, the button can then return that it has been pushed. Buttons with the SELF-ACT style are self-activated instead. This means that they do not send the CMD-GOTO event to your program when clicked. Instead they activate themselves and then send the appropriate button pushed termination status to the program. If you also assign an exception value to the button, it will act just like the equivalent function key. For example, the following statement fragment builds a push button that behaves just like function key 1 (usually marked "F1").

DISPLAY PUSH-BUTTON, SELF-ACT, EXCEPTION-VALUE=1

Self-activating buttons behave differently in some additional, subtle, ways. Normally, if the user down-clicks on a push button and then moves the mouse away before releasing the button, the push button remains active (shown in Windows by a thicker border around the button). But the button is not clicked. Self-activating buttons do not remain active. Instead, they re-activate the previous control. This is done because self-activating controls don't tell the program about the down-click event. To ensure that the program and screen states are consistent, the previous control is re-activated. Also, self-activating buttons do not automatically become the default push button when clicked on with the mouse.

Generally speaking, there is rarely a need to use this style for push buttons defined in a group within the Screen Section. The Screen Section handler performs all the button activation needed when the group is accepted. The SELF-ACT style is mostly useful when you define individual push buttons using the DISPLAY verb (or as elementary Screen Section items) and you do not want to program the activation of those buttons. A common use would be to add push buttons to an existing application where the push buttons will perform the same operation as some function key. In this case, you can simply create the push button with the SELF-ACT style and an exception value that is the same as the function key. Usually, no other coding is needed because the button will perform all of its own activation and simulate the function key when it is clicked.


Note that the SELF-ACT style performs automatic activation only when the user clicks on the button with the mouse or uses its key letter. You must still program your own activation if you want the user to be able to visit the button in some other fashion (for example, by using the "Tab" key to move to the button).
Also note that this style makes the button self-activating, but not any associated Screen Section entry. This means that any BEFORE or AFTER procedures named in an associated Screen Section entry will not automatically execute when the button is clicked. They will function only when you ACCEPT the Screen Section entry in your program.

OK-BUTTON This style is used only when the button is created. It has the effect of changing several of the button's default values. It is equivalent to specifying the following:

TITLE  "OK"
  DEFAULT-BUTTON
  TERMINATION-VALUE = 13


Note that you may override the TITLE and TERMINATION-VALUE settings by providing your own. The net effect of the OK-BUTTON style is that it provides a convenient way of creating a typical "OK" button.
CANCEL-BUTTON This style is similar to the OK-BUTTON style, but it produces a Cancel button instead. It is equivalent to specifying the following defaults when the button is created:

TITLE  "Cancel"
  ESCAPE-BUTTON
  EXCEPTION-VALUE = 27

You may override the TITLE and EXCEPTION-VALUE defaults by providing your own.

BITMAP This style causes the push button to be drawn using a bitmap instead of its default appearance. See Chapter 3, section 3.8, for a complete description.

FRAMED This style is used only with bitmap buttons. It requests that a thin frame be drawn around the button. Typically this appears as a thin black line. Not all systems support frames, in which case the request is ignored. By default, buttons are framed under Windows NT/Windows 2000.

UNFRAMED This style is used only with bitmap buttons. It requests that the button be drawn without a frame. Not all systems support unframed buttons, in which case the request is ignored. By default, buttons are not framed under Windows 95/98.

SQUARE This style is used only with framed bitmap buttons. It forces the button to have square corners. Without this style, the button will have slightly rounded corners.

FLAT This style is used only with bitmap buttons. It creates a button without visible borders on Windows systems. On non-Windows systems, this style has no effect.