Button

Object List Hierarchy Next Object

Definition:

Displays a button that performs a particular function when clicked or
pushed in.

Icon: images/Phx00003.gif

Specialized Features:

The following table lists and describes the properties and events added by Button. There are no added methods.


Property Use to...


Ctrl3d Enable the 3-D effects for the Control.


Event Use to...


Click Perform an action when the user presses and releases a mouse button while on an object, or when the value of a control is changed in code.

GotFocus Define what occurs when an object is given the focus.

KeyDown Define what occurs when the user presses a key while an object has the focus.

KeyPress Define what occurs when the user presses and releases an ANSI key.

KeyUp Define what occurs when the user releases a key while an object has the focus.

LostFocus Define what occurs when an object loses the focus.

Copied Features:

images/Phx00125.gif Properties images/Phx00126.gif Methods images/Phx00127.gif Events

Details:

To choose a button a user can click it, press the space bar when the button has focus, or press ENTER or ESC if the Default or Cancel Button properties were set appropriately. Only one button per form can be designated as the default or cancel operation.

When a button is clicked, it activates its click event. The click event is what allows you to define the actions that take place when the button is clicked. It will typically begin, interrupt, or end a process.

Set the text to display on a button by setting it's Caption property. The size and style of the caption text is specified with the Font property. To assign a mnemonic to the button, include an ampersand (&) immediately before the character in the Caption text that you would like to designate as the keyboard accelerator. An ampersand causes the letter that follows it to be underlined and allows the button to be selected by pressing ALT and the underlined character. For example, if you enter
&Total for the caption, the caption will appear as Total and a user can press ALT and T to select the button.