A BButton object draws a labeled button on-screen and responds when the button is clicked or when it's operated from the keyboard. If the BButton is the default button for its window and the window is the active window, the user can operate it by pressing the Enter key.
BButtons have a single state. Unlike check boxes and radio buttons, the user can't toggle a button on and off. However, the button's value changes while it's being operated. During a click (while the user holds the mouse button down and the cursor points to the button on-screen), the BButton's value is set to 1 (B_CONTROL_ON). Otherwise, the value is 0 (B_CONTROL_OFF).
This class depends on the control framework defined in the BControl class. In particular, it calls these BControl functions:
- SetValue() to make each change in the BControl's value. This is a hook function that you can override to take collateral action when the value changes.
- Invoke() to post a message each time the button is clicked or operated from the keyboard. You can designate the object that should handle the message by calling BControl's SetTarget() function. A model for the message is set by the BButton constructor (or by BControl's SetMessage() function).
- IsEnabled() to determine how the button should be drawn and whether it's enabled to post a message. You can call BControl's SetEnabled() to enable and disable the button.
A BButton is an appropriate control device for initiating an action. Use a BCheckBox, a BPictureButton, or BRadioButtons to set a state.
- The Archive() function adds the following fields to its BMessage argument:
| Field | Type code | Meaning |
| "_default" | B_BOOL_TYPE | Exists and is true if the button is the default |
Copyright 2005 by yellowTAB GmbH, Be Inc., Palm Source Inc. and their respective legal successors
All rights reserved.