htmlInputCheckBox
Checkbox input control class
[Previous] [Main] [Next]


Description
htmlInputCheckBox encapsulates the <INPUT TYPE="CHECKBOX"></INPUT> tags. Checkboxes are toggle switches that a user can select (check) or deselect (uncheck). Checkboxes are arranged in groups using the htmlInputCheckBoxGroup class. Unlike radio buttons, multiple checkboxes in a group can be checked at one time.  
 
If htmlInputCheckBox is used independently of htmlInputCheckBoxGroup, 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/checkbox.h>  
 
Hierarchy
htmlinputcheckbox.gif  
 
See Also
htmlForm, htmlInputCheckBoxGroup  
 
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 ;  
 
typedef enum {  
   horizontal,  
   vertical  
} Arrangement ;  
 
Constructors
htmlInputCheckBox()  
Constructs an empty checkbox object.  
 
htmlInputCheckBox(const String& name,  
      const String& value,  
      const htmlObject& label_element,  
      Boolean check_state = STATE_NOT_CHECKED,  
      Alignment label_align = align_right )  
Constructs a checkbox object, using label_element as the label.  
 
htmlInputCheckBox(const String& name,  
      const String& value,  
      const String& label_text,  
      Boolean check_state = STATE_NOT_CHECKED,  
      Alignment label_align = align_right )  
Constructs a checkbox object, using label_text as the label.  
 
htmlInputCheckBox( const htmlInputCheckBox& rhs )  
Copy constructor.  
 
Destructors
virtual ~htmlInputCheckBox()  
Destroys the object.  
 
Member Methods
=   htmlInputCheckBox& operator=( const htmlInputCheckBox& rhs )  
Replaces the contents with rhs and returns a pointer to the object.  
 
NamehtmlInputCheckBox& Name(const String& name )  
Set the control name to name, and returns a reference to the object. Checkbox controls in a group must all share the same name.  
 
NameString Name() const  
Returns the control name as a string.  
 
ValuehtmlInputCheckBox& 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.  
 
CheckhtmlInputCheckBox& 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.  
 
IsCheckedBoolean IsChecked() const  
Returns TRUE if the state of the control is checked, FALSE if unchecked.  
 
LabelhtmlInputCheckBox& Label( const htmlObject& element )  
Sets (replaces) the label for the control to element, and returns a reference to the object.  
 
LabelhtmlInputCheckBox& 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 object.  
 
LabelhtmlContainer& Label()  
Returns a reference to the label object for the checkbox.  
 
Align   htmlInputCheckBox& 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 checkbox to arrange and returns a reference to the checkbox. Unless this method is explicitly called, the default setting is vertical arrangement. Usually, applications use htmlInputCheckBoxGroup::Arrange() to control arrangement of all checkboxes in a group at one time.  
 
ArrangeArrangement Arrange() const  
Returns the arrangement setting used for the checkbox 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:Checkboxes  




©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.