Back to the Packages
Constructor
new Win32::GUI::Textfield(PARENT, %OPTIONS)
Methods
LineFromChar(INDEX)
MaxLength([CHARS])
Modified([FLAG])
PasswordChar([CHAR])
ReadOnly([FLAG])
ReplaceSel(STRING, [FLAG])
Select(START, END)
SelectAll()
Selection()
Undo()
Events
Change()
GotFocus()
LostFocus()
Creates a new Textfield object; can also be called as PARENT->AddTextfield(%OPTIONS). Class specific %OPTIONS are:
-align => left/center/right (default left) aligns the text in the control accordingly. -keepselection => 0/1 (default 0) the selection is not hidden when the control loses focus. -multiline => 0/1 (default 0) the control can have more than one line (note that newline is "\r\n", not "\n"!). -password => 0/1 (default 0) masks the user input (like password prompts). -passwordchar => char (default '*') the char that is shown instead of the text with -password => 1. -prompt => (see below) -readonly => 0/1 (default 0) text can't be changed.
The -prompt option is very special; if a string is passed, a Win32::GUI::Label object (with text set to the string passed) is created to the left of the Textfield. Example:
$Window->AddTextfield( -name => "Username", -left => 75, -top => 150, -prompt => "Your name:", );
Furthermore, the value to -prompt can be a reference to a list containing the string and an additional parameter, which sets the width for the Label (eg. [ STRING, WIDTH ] ). If WIDTH is negative, it is calculated relative to the Textfield left coordinate. Example:
-left => 75, (Label left) (Textfield left) -prompt => [ "Your name:", 30 ], 75 105 (75+30) -left => 75, -prompt => [ "Your name:", -30 ], 45 (75-30) 75
Note that the Win32::GUI::Label object is named like the Textfield, with a "_Prompt" suffix (in the example above, the Label is named "Username_Prompt").
Returns the line where the zero-based INDEX char appears.
MaxLength([CHARS]) Limits the number of characters that the Textfield accept to CHARS, or returns the current limit if no argument is given. To remove the limit (eg. set it to the maximum allowed which is 32k for a single-line Textfield and 64k for a multiline one) set CHARS to 0. Modified([FLAG]) Gets or sets the modified flag on the textfield. PasswordChar([CHAR]) Gets or sets the character displayed in place of normal text; if the Textfield has been created with the -password option, the default character is an asterisk (*). Note that by setting this value the text in the textfield will be redrawn using the specified character; if the character is set to zero instead, text will be redrawn as normal ReadOnly([FLAG]) Gets or sets the readonly flag on the textfield. ReplaceSel(STRING, [FLAG]) Replaces the current selection in the Textfield with STRING. Select(START, END) Selects the specified range of characters. SelectAll() Selects all the text. Selection() Returns a two elements array containing the current selection start and end. Undo() Undoes the last change in the textfield.
Limits the number of characters that the Textfield accept to CHARS, or returns the current limit if no argument is given. To remove the limit (eg. set it to the maximum allowed which is 32k for a single-line Textfield and 64k for a multiline one) set CHARS to 0.
Modified([FLAG]) Gets or sets the modified flag on the textfield. PasswordChar([CHAR]) Gets or sets the character displayed in place of normal text; if the Textfield has been created with the -password option, the default character is an asterisk (*). Note that by setting this value the text in the textfield will be redrawn using the specified character; if the character is set to zero instead, text will be redrawn as normal ReadOnly([FLAG]) Gets or sets the readonly flag on the textfield. ReplaceSel(STRING, [FLAG]) Replaces the current selection in the Textfield with STRING. Select(START, END) Selects the specified range of characters. SelectAll() Selects all the text. Selection() Returns a two elements array containing the current selection start and end. Undo() Undoes the last change in the textfield.
Gets or sets the modified flag on the textfield.
PasswordChar([CHAR]) Gets or sets the character displayed in place of normal text; if the Textfield has been created with the -password option, the default character is an asterisk (*). Note that by setting this value the text in the textfield will be redrawn using the specified character; if the character is set to zero instead, text will be redrawn as normal ReadOnly([FLAG]) Gets or sets the readonly flag on the textfield. ReplaceSel(STRING, [FLAG]) Replaces the current selection in the Textfield with STRING. Select(START, END) Selects the specified range of characters. SelectAll() Selects all the text. Selection() Returns a two elements array containing the current selection start and end. Undo() Undoes the last change in the textfield.
Gets or sets the character displayed in place of normal text; if the Textfield has been created with the -password option, the default character is an asterisk (*). Note that by setting this value the text in the textfield will be redrawn using the specified character; if the character is set to zero instead, text will be redrawn as normal
ReadOnly([FLAG]) Gets or sets the readonly flag on the textfield. ReplaceSel(STRING, [FLAG]) Replaces the current selection in the Textfield with STRING. Select(START, END) Selects the specified range of characters. SelectAll() Selects all the text. Selection() Returns a two elements array containing the current selection start and end. Undo() Undoes the last change in the textfield.
Gets or sets the readonly flag on the textfield.
ReplaceSel(STRING, [FLAG]) Replaces the current selection in the Textfield with STRING. Select(START, END) Selects the specified range of characters. SelectAll() Selects all the text. Selection() Returns a two elements array containing the current selection start and end. Undo() Undoes the last change in the textfield.
Replaces the current selection in the Textfield with STRING.
Select(START, END) Selects the specified range of characters. SelectAll() Selects all the text. Selection() Returns a two elements array containing the current selection start and end. Undo() Undoes the last change in the textfield.
Selects the specified range of characters.
SelectAll() Selects all the text. Selection() Returns a two elements array containing the current selection start and end. Undo() Undoes the last change in the textfield.
Selects all the text.
Selection() Returns a two elements array containing the current selection start and end. Undo() Undoes the last change in the textfield.
Returns a two elements array containing the current selection start and end.
Undo() Undoes the last change in the textfield.
Undoes the last change in the textfield.
Sent when the text in the field is changed by the user.
GotFocus() Sent when the control is activated. LostFocus() Sent when the control is deactivated.
Sent when the control is activated.
LostFocus() Sent when the control is deactivated.
Sent when the control is deactivated.
3 POD Errors
The following errors were encountered while parsing the POD:
You can't have =items (as at line 95) unless the first thing after the =over is an =item
You can't have =items (as at line 152) unless the first thing after the =over is an =item
You can't have =items (as at line 248) unless the first thing after the =over is an =item
To install Win32::GUI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::GUI
CPAN shell
perl -MCPAN -e shell install Win32::GUI
For more information on module installation, please visit the detailed CPAN module installation guide.