ICheckBox

The ICheckBox class creates and manages check box control windows.

A check box is a square box with associated text that represents a choice. When a user selects the choice, the check box is filled to indicate that the choice is selected. If the user selects the check box again, the choice is deselected.

Process selection of a check box by deriving objects from the ISelectHandler class and by adding a handler to either the check box object or to its owner window.

You can attach the following handlers to this control:


ICheckBox - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of the ICheckBox class. You cannot copy or assign ICheckBox objects because both the copy constructor and assignment operator are private functions.


[view class]
~ICheckBox
public:
virtual ~ICheckBox()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
ICheckBox


Overload 1
public:
ICheckBox(unsigned long id, IWindow* parent)

Constructs an object from a dialog (parent) window, and the ID of a check box control on that dialog window.

id
The window ID of the check box.
parent
The dialog (parent) window.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
ICheckBox(const IWindowHandle& handle)

Constructs the object using the handle of an existing check box window.

handle
The window handle of an existing check box control.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
public:
ICheckBox( unsigned long id, IWindow* parent, IWindow* owner, const IRectangle& initial = IRectangle ( ), const Style& style = defaultStyle ( ) )

Constructs a check box control and an object for it using the following parameters:

id
The window ID of the check box.
parent
The parent window.
owner
The owner window.
initial
The initial position and size of the check box you are constructing. The default is IRectangle. Optional.
style
The check box's characteristics. Optional.

Exception

IInvalidParameter The parent window pointer specified was invalid. You must specify a valid IWindow pointer as the parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Auto Select

Auto select members query and modify the autoSelect style of a check box object. The autoSelect style determines whether the state of the check box is automatically changed when the user clicks on it.


[view class]
disableAutoSelect
public:
virtual ICheckBox& disableAutoSelect()

Removes the autoSelect style from the check box control. If auto select is disabled, the application is responsible for changing the state of the check box when the check box is clicked.

The application determines when the user clicks on the check box by attaching a handler derived from ISelectHandler to the check box or its owner and overriding the ISelectHandler::selected member function. The application can then use the selection functions to change the check box' state.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

AIX does not support this function; therefore, it has no effect.


[view class]
enableAutoSelect
public:
virtual ICheckBox& enableAutoSelect(bool enable = true)

Sets the check box control to the style autoSelect or removes the autoSelect style from the control.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

The AIX version does not support this function; therefore, it has no effect. In the AIX version, check boxes are always automatically selected.


[view class]
isAutoSelect
public:
virtual bool isAutoSelect() const

If the check box control has the autoSelect style set, true is returned. Otherwise, false is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

AIX does not support this function; therefore, it returns true. In the AIX version, check boxes are always automatically selected.


Layout Support

Layout support members supply information used by the canvas classes to provide dialog-like behavior.


[view class]
calcMinimumSize
protected:
virtual ISize calcMinimumSize() const

Returns the minimum size this check box control can be, based on the text string length and the current font.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Styles

These style members provide a set of valid styles for this class. Use these members to query and set check box styles. You can use these styles with the styles in the following classes:


[view class]
convertToGUIStyle
public:
virtual unsigned long convertToGUIStyle( const IBitFlag& style, bool extendedOnly = false ) const

Converts a style object into a value appropriate for the presentation system. The default action is to return the base GUI styles for the platform. Extended styles defined by the application are returned if you set extendedOnly to true.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
defaultStyle
public:
static Style defaultStyle()

Returns the default style. The default style is classDefaultStyle unless you have changed the style using setDefaultStyle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setDefaultStyle
public:
static void setDefaultStyle(const Style& style)

Sets the default style for all subsequent check boxes.

style
Use the styles provided by ICheckBox Styles to specify the default style.

This member function is not thread safe. In a multithreaded application, it should only be called when a conflict is not possible. A conflict can arise if you set the default style on one thread at the same time that it is being queried on another. In this situation, the query would take place while the style is in an unknown state.

When you create a window class and do not specifically specify window styles in the constructor, the Open Class Library queries the default style. Therefore, the only safe place to call this member function is when no other application threads that create windows are active.

Another way to avoid a conflict in a multithreaded application is to specifically specify window styles on window construction, rather than calling this member function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
autoSelect
public:
static const Style autoSelect

The auto select style determines whether the state of the check box is automatically changed when the user clicks on it. If auto select is enabled, the state of the check box automatically cycles between the selected and not selected states. If auto select is disabled, the application must change the state of the check box when the check box is clicked.

The application determines when the user clicks on the check box by attaching a handler derived from ISelectHandler to the check box or its owner and overriding the ISelectHandler::selected member function. The application can then use the selection functions to change the check box' state.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored

AIX Considerations

The autoSelect style is always selected in the Motif version. You cannot disable auto selection of check boxes.


[view class]
classDefaultStyle
public:
static const Style classDefaultStyle

Provides the original default style for this class, which is the following: ICheckBox::autoSelect | IWindow::visible.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ICheckBox - Inherited Member Functions and Data

Inherited Public Functions

IButton
IControl
INotifier
ISettingButton
ITextControl
IWindow

Inherited Public Data

IWindow
INotifier
IButton
ISettingButton
ITextControl

Inherited Protected Functions

IWindow
INotifier
IButton
IControl
ITextControl
ISettingButton

Inherited Protected Data