%w | widget name | |
%t | type of event, one of buttonPress, button2Press or button3Press | |
%x | mouse pointer x coordinate | |
%y | mouse pointer y coordinate | |
%b | button number | |
%s | state of buttons and modifiers (bitmask) |
%w | widget name | |
%t | type of event, one of buttonPress, button2Press or button3Press | |
%x | mouse pointer x coordinate | |
%y | mouse pointer y coordinate | |
%b | button number | |
%s | state of buttons and modifiers (bitmask) |
%w | widget name | |
%t | type of event, one of buttonPress, button2Predd or button3Press | |
%x | mouse pointer x coordinate | |
%y | mouse pointer y coordinate | |
%b | button number | |
%s | state of buttons and modifiers (bitmask) |
%w | widget name | |
%t | type of event, one of buttonPress, button2Predd or button3Press | |
%x | mouse pointer x coordinate | |
%y | mouse pointer y coordinate | |
%b | button number | |
%s | state of buttons and modifiers (bitmask) |
type: string (default: "")
Tcl script which is executed if the mouse pointer moves inside the widget. Before evaluation the following percent strings are substituated
%w | widget name | |
%x | mouse pointer x coordinate | |
%y | mouse pointer y coordinate | |
%s | state of buttons and modifiers (bitmask) |
type: string (default: "")
Tcl script which is executed in the global scope if the "show-help" signal is recieved, which is normally the case if the user presses F1 or Ctrl-F1. Before evaluation the following percent strings are substituated
%w | widget name | |
%h | help type: either "whatsThis" or "tooltip" |
type: string (default: "")
Tcl script which is executed when a valid tag is applied to the contexts of the textbuffer. Before evaluation the following percent strings are substituated
%t | name of tag applied | |
%c | column from which the tag was applied | |
%r | row from which the tag was applied | |
%l | line to which the tag was applied | |
%o | offset to which the tag was applied |
type: string (default: "")
Tcl script which is executed when the buffer signals that user input has begun. Before evaluation the following percent strings are substituated
%b | value =1. As this event occurs only when user action is begun, it always returns the value 1. |
See Also: -onEndUserAction
type: string (default: "")
Tcl script which is executed when a valid tag is applied to the contexts of the textbuffer. Before evaluation the following percent strings are substituated
%r | row from which the text was deleted | |
%c | column from which the text was deleted | |
%l | line to which the text was deleted | |
%o | offset to which the text was deleted | |
%t | deleted text |
type: string (default: "")
Tcl script which is executed when the buffer signals that user input has ended. Before evaluation the following percent strings are substituated
%e | value =1. As this event occurs only when user action ends, it always returns the value 1. |
See Also: -onBeginUserAction
type: string (default: "")
Tcl script which is executed when a valid tag is applied to the contexts of the textbuffer. Before evaluation the following percent strings are substituated
%a | anchor name | |
%r | row at which the anchor has been inserted. | |
%c | column at which the anchor has been inserted |
type: string (default: "")
Tcl script which is executed when a valid tag is applied to the contexts of the textbuffer. Before evaluation the following percent strings are substituated
%t | text inserted | |
%r | row at which the text was inserted | |
%c | column at which the text was inserted | |
%l | length of text inserted |
type: string (default: "")
Tcl script which is executed when a valid tag is applied to the contexts of the textbuffer. Before evaluation the following percent strings are substituated
%n | name of the mark inserted | |
%r | row at which the text was inserted | |
%c | column at which the text was inserted |
type: string (default: "")
Tcl script which is executed when a valid tag is applied to the contexts of the textbuffer. Before evaluation the following percent strings are substituated
%n | name of the deleted mark |
type: string (default: "")
Tcl script which is executed when the buffer signals that the contexts of the text buffer has been modified. Before evaluation the following percent strings are substituated
%c | value =1. As this event occurs only the buffer content changes, it always returns the value 1. |
type: string (default: "")
Tcl script which is executed when a valid tag is applied to the contexts of the textbuffer. Before evaluation the following percent strings are substituated
%t | name of tag removed | |
%r | row from which the tag removal began | |
%c | column from which the tag removal began | |
%l | line at which the tag removal ended | |
%o | offset at which the tag removal ended |
type: always, never, automatic (default: automatic)
When to show scrollbars. If the value is a list of two elements, the first value is for the horizontal scrollbar and the second value for the vertical scrollbar.
type: integer
Pixels between lines after wrap.
type: integer
Pixels below lines.
type: integer
Pixels above lines.
type: boolean (default: 1)
Whether the text in the widget is editable.
type: ONEOF none, char, word
Wrap mode used for the rendering of the cells.
type: ONEOF left, right, center, fill
Justification of the lines in one cell.
type: integer
type: integer
type: integer
type: boolean (default: 1)
Whether the cursor is visible.
type: 1
This sets the focus to the widget. To unset the focus it must be set to another widet.
type: boolean (default: 1)
Whether or not the item is sensitve to user input.
type: boolean (default: 1)
Whether or not the item is visible.
type: string
Name of the widget, can be used to set options in an rc file.
type: string
Message that appear next to this widget when the mouse pointer is held over it for a short amount of time.
A text widget is used to input and show formatted text. Some text commands need an index as parameter. An index can be either a list of the row and the column, both starting at 0, for example "1 7", or a keyword like end, cursor, selectionStart, selectionEnd with an (without space) appended character offset, for example "selectionStart+3".
id class
Returns the class of the widget, i.e. text.
id configure [-option value...]
Configures the widget. Option may have any of the values accepted on creation of the widget.
id copy
Copies all text to the clipboard.
id cut
Copies all text to the clipboard and removes it from the widget.
id delete
Deletes the widget and the associated tcl command.
id signalEmit signal
Causes the widget to emit a signal under programme control. This causes the handling scripts configured to the matching signal to be called.
id erase startIndex ?endIndex?
Removes all text between startIndex and endIndex. endIndex defaults to end.
id get startIndex ?endIndex?
Returns the text between startIndex and endIndex. endIndex defaults to end.
Returns the position position of the cursor as list of its row and column
id getCursor
Returns the position position of the cursor as list of its row and column
Returns the number of characters in the widget.
Returns the number of lines in the current text view.
Returns the number of characters in the line specified by the given index.
id insert index text ?-tags taglist?
Inserts and position indext the text text. If taglist is given the text is taged with each element of the list.
id paste
Pastes text from the clipboard at the current cursor position.
id scrollToMark mark
Scrolls the widget so that the specified mark is visible.
id scrollToPosition index [-option value...]
Scrolls the widget so that the specified index is visible.
Options
type: a list of the horizontal and vertical alignment or one of topLeft, top, topRight, left, center, right, bottomLeft, bottom, or bottomRight
Specifies where the index shall be shown.
type: 0 lt float lt 1
Specifies the margin.
id select startIndex ?endIndex?
Select the text between startIndex and endIndex. endIndex defaults to end.
id setCursor index
Sets the cursor to position index.
id tag apply startIndex endIndex -tags taglist
id tag create tagName [-option value...]
Creates a tag with name tagName and configures it dependent of the options given. The options are the same as with tag configure.
id tag delete tagName
Delete tag defintion from the textbuffer tag table. All instances of the tag in the textbuffer will be automatically removed.
id tag configure tagName [-option value...]
Configures the existing tag tagName.
Options
type: color
Background color of the text.
type: boolean (default: 0)
Whether the text can be edited.
type: color
Foreground color of the text.
type: FONT
Font of the text.
Font family of the text.
type: ONEOF normal, oblique, italic (default: normal)
Font style of the text.
type: ONEOF normal, smallCaps (default: normal)
Font variant of the text.
type: ONEOF ultralight, light, normal, bold, ultrabold, heavy (default: normal)
Font weight of the text.
type: integer (default: 0)
How many pixels the text should be risen.
type: ONEOF ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded (default: normal)
Font stretch of the text.
type: integer
Font size of the text.
type: float ORONEOF xx-small, x-small, small, medium, large, x-large, xx-large (default: normal)
Font scale used.
type: string (default: "")
Tcl command which is executed when the buffer signals that a mouse even has occurs in region tagged. Before evaluation the following percent strings are substituated
%w | widget name | |
%n | tag name | |
%t | type of event | |
%x | mouse pointer x coordinate | |
%y | mouse pointer y coordinate | |
%b | button number | |
%s | state of buttons and modifiers (bitmask) |
type: boolean (default: 0)
Whether the text is invisible.
type: ONEOF left, right, center, fill
Justification of the lines.
type: boolean (default: 0)
Whether the text is struck through.
type: ONEOF none, single, double, low (default: none)
How the text should be underlined.
type: ONEOF none, char, word
Wrap mode used.
id tag remove startIndex endIndex -tags taglist
set text [gnocl::text -scrollbar always]
$text tag create bold -fontWeight bold -foreground blue
$text insert end "This is "
$text insert end "Gnocl" -tags bold
$text insert end "!"
gnocl::window -title "Text" -child $text
results in