...
Name
qtextedit — multiline text editor
Syntax
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
qtextedit |
Description
The qtextedit command creates a QTextEdit object. This is a multiline text editor in which the user may edit text interactively or programmatically. To set the contents of the editor use the qsettext command. To append text use qappend. To retrieve the text use qtext. The editor contents may be cleared using qclear.
Arguments
None
Examples
Ex.1: QTextEdit
Anchor | ||||
---|---|---|---|---|
|
No Format | ||||
---|---|---|---|---|
| ||||
# Create toplevel window
set w [qwidget ]
qsetwindowtitle QTextEdit
# Create editor and insert/retrieve text
qvboxlayout {
set editor [qtextedit]
qsettext $editor "Hello World"
qappend $editor "Appending text is easy"
# Get text and assign to Tcl variable
set text [qtext $editor]
puts $text
}
qshow $w
{noformat}
!att:_img_cmd^qtextedit.png!
Example +QTextEdit+ shows a QTextEdit with text added using the [qsettext] and [qappend] commands.
h3. |
Example QTextEdit shows a QTextEdit with text added using the qsettext and qappend commands.
Ex.2:
...
Editor
...
with
...
clear
...
button
...
Anchor | ||||
---|---|---|---|---|
|
No Format | ||||
---|---|---|---|---|
| ||||
set w [qwidget]
qsetwindowtitle "Editor"
qvboxlayout {
set editor [qtextedit]
qpushbutton Clear "qclear $editor"
}
qshow $w
{noformat}
!att:_img_cmd^qtextedit_clear.png!
Example +Editor with clear button+ illustrates use of the [qclear] command. Pressing the *Clear* button will clear the textual contents of the editor.
|
Example Editor with clear button illustrates use of the qclear command. Pressing the Clear button will clear the textual contents of the editor.