|
htmlInputTextArea
Multi-line text input control class | [Previous] [Main] [Next] |
| htmlInputTextArea encapsulates the <TEXTAREA></TEXTAREA> tags. It defines a multi-line text input field on a form.
| |
|
| |
| The text value of the control can be set using the assignment = operator or the Value() method. Text can be appended to the control using the insertion << operator or the Add() method. Likewise, the text value can be retrieved easily using the overloaded Value() method or the (String) casting operator.
| |
|
| |
| The number of characters per line is controlled using the Columns() method. Similarly, the number of rows that are displayed without scrolling is controlled using the Rows() method. Scrollbars will automatically appear in the input area if the text entered exceeds the specified number of columns or rows.
| |
|
| |
| Wrapping of words to new lines within the text area can be enabled or disabled using the Wrap() method.
| |
|
| |
| #include <dcmicro/htmlpp/textarea.h>
| |
|
| |
|
| |
| htmlForm, htmlInputText
| |
|
| |
| typedef enum {
| |
| wrap_default = 0,
| |
| wrap_off,
| |
| wrap_soft,
| |
| wrap_hard
| |
| } WordWrapType ;
| |
|
| |
| htmlInputTextArea()
| |
| Constructs an empty object.
| |
|
| |
| htmlInputTextArea( const String& name, int rows, int columns )
| |
| Constructs an empty object using the specified control name, with a maximum display area of rows and columns.
| |
|
| |
| htmlInputTextArea( const String& name,
| ||
| const String& value,
| ||
| int rows,
| ||
| int columns )
| ||
| Constructs an object using the specified control name, with a maximum display area of rows and columns, populating it with text value.
| |
|
| |
| virtual ~htmlInputTextArea()
| |
| Destroys the object.
| |
|
| |
| = | htmlInputTextArea& operator=( const htmlInputTextArea& rhs )
| |
| Replaces the contents with rhs and returns a pointer to the object.
| |
|
| |
| = | htmlInputTextArea& operator=( const String& text )
| |
| Replaces the text value of the control with text and returns a pointer to the object. Functionally equivalent to the Value() method.
| |
|
| |
| << | htmlInputTextArea& operator<< ( const String& text )
| |
| Appends the text string to the object, and returns a reference to the object. Functionally equivalent to the Add() method.
| |
|
| |
| (String) | htmlInputTextArea& operator String() const
| |
| Returns the control value as a string, or an empty string if not set. Functionally equivalent to the Value() method.
| |
|
| |
| Add | htmlInputTextArea& Add( const String& text )
| |
| Appends the text string to the object, and returns a reference to the object. Functionally equivalent to the << operator.
| |
|
| |
| Name | htmlInputTextArea& Name(const String& name )
| |
| Sets the control name to name, and returns a reference to the object.
| |
|
| |
| Name | String Name() const
| |
| Returns the control name as a string, or an empty string if not set.
| |
|
| |
| Value | htmlInputTextArea& Value(const String& value )
| |
| Replaces the text value of the control with value, and returns a reference to the object.
| |
|
| |
| Value | String Name() const
| |
| Returns the text value of the control as a string, or an empty string if not set.
| |
|
| |
| Columns | htmlInputTextArea& Columns(int columns )
| |
| Sets the display width, in columns, of the control value to columns, and returns a reference to the object.
| |
|
| |
| Columns | int Columns() const
| |
| Returns the number of columns for the control display width, or zero if not set.
| |
|
| |
| Rows | htmlInputTextArea& Rows( int rows )
| |
| Sets the display height, in rows, of the control value to rows, and returns a reference to the object.
| |
|
| |
| Rows | int Rows() const
| |
| Returns the number of rows for the control display height, or zero if not set.
| |
|
| |
| Wrap | htmlInputTextArea& Wrap( WordWrapType wrap )
| |
| Sets how the browser wraps words on lines longer than the text area's column width, and returns a reference to the object.
| |
|
| |
|
|
| |
| Wrap | WordWrapType Wrap() const
| |
| Returns the word wrap setting as an integer.
| |
|
| |
| Clone | htmlObject FAR * Clone() const
| |
| Returns a base-class pointer to a deep copy of the object.
| |
|
| |
| void Print( ostream& os ) const
| ||
| Outputs the object to os.
| |
|
| |
|
| |
| See Also: Tutorial: Forms: Multi-line Text Input
| |
|
| |
| #include <stdio.h>
| |
| #include <stdlib.h>
| |
| #include <dcmicro/htmlpp/htmlpp.h>
| |
|
| |
| int main( void )
| |
| {
| |
| htmlCgi server ;
| |
| htmlPage page( "html++ example application" ) ;
| |
|
| |
| // Create a simple form to hold our controls
| |
| htmlForm form( "/cgi-bin/script" ) ;
| |
|
| |
| // Create a 5 row X 30 column text area control,
| |
| // using soft word-wrapping.
| |
| htmlInputTextArea area( "comment", 5, 30 ) ;
| |
| area.Wrap( wrap_soft ) ;
| |
|
| |
| // Initiallly populate the control with some text
| |
| area = "This is an example of a multi-line "
| |
| "text input control. Soft wrapping means "
| |
| "word wrap is enabled, but line breaks "
| |
| "won't be included in the value when the "
| |
| "form is submitted." ;
| |
|
| |
| // Include a submit button to be complete
| |
| form << htmlCenter( area )
| |
| << htmlParagraph()
| |
| << htmlCenter( htmlInputSubmit() ) ;
| |
|
| |
| page << form ;
| |
|
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
| <FORM ACTION="/cgi-bin/script" METHOD="POST">
| |
| <CENTER>
| |
| <TEXTAREA NAME="comment" ROWS="5" COLS="30" WRAP="SOFT">This is an example of a multi-line text input control. Soft wrapping means word wrap is enabled, but line breaks won't be included in the value when the form is submitted.</TEXTAREA>
| |
| </CENTER><P></P>
| |
| <CENTER><INPUT TYPE="SUBMIT"></CENTER></FORM>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
|
| |
| |
