Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TRadioButtons Class Reference

Cluster of radio buttons. More...

#include <dialogs.h>

Inheritance diagram for TRadioButtons::

TCluster TView TObject TStreamable List of all members.

Public Methods

 TRadioButtons (const TRect &bounds, TSItem *aStrings)
virtual void draw ()
virtual Boolean mark (int item)
virtual void movedTo (int item)
virtual void press (int item)
virtual void setData (void *rec)

Static Public Methods

TStreamablebuild ()

Static Public Attributes

const char* const name

Protected Methods

 TRadioButtons (StreamableInit)

Detailed Description

This view implements a cluster of radio buttons.

TRadioButtons objects are clusters controls with the special property that only one control button in the cluster can be selected at any moment. Selecting an unselected button will automatically deselect (restore) the previously selected button.

The user can select a button with mouse clicks, cursor movements, and Alt-letter shortcuts. Each radio button can be highlighted and selected (with the Spacebar). An "." appears in the radio button when it is selected.

Other parts of your application typically examine the state of the radio buttons to determine which option has been chosen by the user.

Radio button clusters often have associated TLabel objects to give the user an overview of the clustered options.

TRadioButtons interprets value as the number of the "pressed" button, with the first button in the cluster being number 0.

See also:
TCheckBoxes

Definition at line 1181 of file dialogs.h.


Constructor & Destructor Documentation

TRadioButtons::TRadioButtons ( const TRect & bounds,
TSItem * aStrings ) [inline]
 

Constructor.

`bounds' is the bounding rectangle of the view. `aStrings' points to a linked list of TSItem objects, one for each radio button, and is assigned to strings data member.

Every TSItem object stores the caption of the related radio button. TRadioButtons handles a maximum of 2^32 radio buttons.

The sel and value data members are set to zero; options is set to (ofSelectable | ofFirstClick | ofPreProcess | ofPostProcess).

Definition at line 1292 of file dialogs.h.

TRadioButtons::TRadioButtons ( StreamableInit ) [protected]
 

Constructor.

Used to recover the view from a stream. Each streamable class needs a "builder" to allocate the correct memory for its objects together with the initialized virtual table pointers. This is achieved by calling this constructor with an argument of type StreamableInit.


Member Function Documentation

TStreamable * TRadioButtons::build ( ) [static]
 

Creates a new TRadioButtons view.

Called to create an object in certain stream-reading situations.

Reimplemented from TCluster.

void TRadioButtons::draw ( ) [virtual]
 

Draws the TRadioButtons object by calling the inherited TCluster::drawBox() member function.

The default radio button is " ( ) " when unselected and " (.) " when selected. Note that if the boundaries of the view are sufficiently wide, radio buttons can be displayed in multiple columns.

Reimplemented from TView.

Boolean TRadioButtons::mark ( int item ) [virtual]
 

Returns True if the specified radio button is pressed; that is, if `item' is equal to value data member.

Integer `item' specifies which radio button to check. 0 is the first radio button, 1 is the second radio button, etc.

Reimplemented from TCluster.

void TRadioButtons::movedTo ( int item ) [virtual]
 

Called whenever the user moves the selection to another radio button.

Sets value data member to `item'. This will press `item' radio button and release the previously pressed radio button.

See also:
TCluster::movedTo , TCluster::value

Reimplemented from TCluster.

void TRadioButtons::press ( int item ) [virtual]
 

Called to press another radio button.

Integer `item' specifies which radio button to press. The previous radio button is released. 0 is the first radio button, 1 the second radio button, etc.

See also:
TCluster::press

Reimplemented from TCluster.

void TRadioButtons::setData ( void * rec ) [virtual]
 

Writes the data record of this view.

This method calls TCluster::setData() and after sets sel data member to value data member. This will move the selection on the currently pressed radio button.

Reimplemented from TCluster.


Member Data Documentation

const char *const TRadioButtons::name [static]
 

Undocumented.

Reimplemented from TCluster.

Definition at line 1261 of file dialogs.h.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:32 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001