htmlInputRadio
Radio input control class
[Previous] [Main] [Next]


Description
htmlInputRadio encapsulates the <INPUT TYPE="RADIO"></INPUT> tags. Radio buttons are arranged as a group using the htmlInputRadioGroup class. Only one button in the set can be selected (checked) at one time. When the user selects a button in the set, all the other buttons are deselected. You can preselect a button using the Check() method.  
 
If htmlInputRadio is used independently of htmlInputRadioGroup, you must specify a name for the control to identify it on a form. Otherwise, you can leave the name argument of the constructor as an empty ("") string and the object will assume the name of the group to which it belongs.  
 
Declaration
#include <dcmicro/htmlpp/radio.h>  
 
Hierarchy
htmlinputradio.gif  
 
See Also
htmlForm, htmlInputRadioGroup  
 
Related Constants/Definitions
#define STATE_CHECKED      TRUE  
#define STATE_NOT_CHECKED      FALSE  
 
typedef enum {  
   align_default = 0,  
   align_left,  
   align_center,  
   align_right,  
   align_justify  
} Alignment ;  
 
Constructors
htmlInputRadio()  
Constructs an empty radio control object.  
 
htmlInputRadio( const String& name,  
    const String& value,  
    const htmlObject& label_element,  
    Boolean check_state = STATE_NOT_CHECKED,  
    Alignment label_align = align_right )  
Constructs a radio control object of the specified name and value, using label_element as the label, and setting the initial check_state and alignment..  
 
htmlInputRadio( const String& name,  
    const String& value,  
    const String& label_text,  
    Boolean check_state = STATE_NOT_CHECKED,  
    Alignment label_align = align_right )  
Constructs a radio control object of the specified name and value, using label_text as the label, and setting the initial check_state and alignment..  
 
htmlInputRadio( const htmlInputRadio& rhs )  
Copy constructor.  
 
Destructors
virtual ~htmlInputRadio()  
Destroys the object.  
 
Member Methods
=   htmlInputRadio& operator=( const htmlInputRadio& rhs )  
Replaces the contents with rhs and returns a pointer to the object.  
 
NamehtmlInputRadio& Name(const String& name )  
Set the control name to name, and returns a reference to the object. Radio controls in a group must all share the same name.  
 
NameString Name() const  
Returns the control name as a string.  
 
ValuehtmlInputRadio& Value(const String& value )  
Set the display value of the control to value, and returns a reference to the object.  
 
ValueString Value() const  
Returns the control value as a string.  
 
CheckhtmlInputRadio& Check( Boolean check_state = STATE_CHECKED )  
Sets the check state of the control, and returns a reference to the object. If check_state is TRUE, the control appears checked. For a group of radio controls, only one control at a time may be checked.  
 
IsCheckedBoolean IsChecked() const  
Returns TRUE if the state of the control is checked, FALSE if unchecked.  
 
LabelhtmlInputRadio& Label( const htmlObject& element )  
Sets (replaces) the label for the control to element, and returns a reference to the object.  
 
LabelhtmlInputRadio& Label( const String& text )  
Sets (replaces) the label for the control to text, internally converting text to an htmlText object, and returns a reference to the control object.  
 
LabelhtmlContainer& Label()  
Returns a reference to the label object for the radio control.  
 
Align   htmlInputRadio& Align( Alignment align )  
Sets the label alignment to align and returns a reference to the object.  
 
Align   int Align() const  
Returns the label alignment for the control, or align_default if not set.  
 
ArrangehtmlInputRadio& Arrange( Arrangement arrange )  
Sets the arrangement for the radio button to arrange and returns a reference to the button. Unless this method is explicitly called, the default setting is vertical arrangement. Usually, applications use htmlInputRadioGroup::Arrange() to control arrangement of all buttons in a group at one time.  
 
ArrangeArrangement Arrange() const  
Returns the arrangement setting used for the button object.  
 
Print   void Print( ostream& os ) const  
Outputs the object to os.  
 
ClonehtmlObject FAR * Clone() const  
Returns a base-class pointer to a deep copy of the object.  
 
Example
 
See the example in Tutorial:Forms:Radio Buttons  
 


©1998 DC Micro Development. All rights reserved.
No portion of this document may be c opied or reproduced without expressed written consent.
html++ is a trademark of DC Micro Development.