A text widget that corresponds to a TK text widget The widget must first be created, either using the default create routine, or the full creation routine that supplies a parent widget, text configuration options and packing information
Once created, text may be inserted into the widget at locations that are specified using TINDEX es. A TINDEX indicates a location in the text widget in a number of ways - see the interface to TINDEX.
Eg. t.insert_at(TINDEX::at(1,0,"text");
Ranges of text may also be tagged using a TEXT_TAG, either at insertion or later on by specifying positions
Callbacks, basically bound routines, may then be associated with a particular text tag
mytag ::= #TK_TEXT_TAG("mytag"); t.bind(mytag,EVENT_INCLUDE::enter,bind(myput(_)));
The callback routine myput is of the form myput(arg: TEXT_CB) is

end; It is best to use TK_TEXT widgets by first including GUI_UTIL which makes many commonly used functions conveniently accessible.

Flattened version is here



Readable Attributes

act_on(id: INT,cb: ARRAY{STR})
**** Internal GUI interface. Do not use explicitly Go through the args - convert them into a TEXT_CB and then call the appropriate function 0 = id 1 = button 2 = x 3 = y
add_tag(t: TK_TEXT_TAG,from,to: TK_INDEX)
**** Add a tag "t" to the text from "from" to "to"
bind_event(t: TK_TEXT_TAG,event: $TK_EVENT, action: ROUT{TK_TEXT_CB})
configure_tag(t: TK_TEXT_TAG,c: TK_TEXT_TAG_CFG)
**** Configure the text associated with the tag "t" to have the properties specified by the configuration "c".
delete(from,to: TK_INDEX)
get(from,to: TK_INDEX): STR
insert_at(position: TK_INDEX,text:STR)
**** Insert untagged text at "position"
insert_tagged(position: TK_INDEX,text: STR, tags: ARRAY{TK_TEXT_TAG})
**** Insert text "text" with the tags "tags" at the location indicated by "position"
plus(text: $STR)
plus(text: $STR):SAME
see(index: TK_INDEX)
**** Make index visible


default_init(c: TK_TEXT_CFG)
**** By default, use scrollbars
attr tag_callbacks: TK_WIDGET_CALLBACKS{ROUT{TK_TEXT_CB}};
attr tag_callbacks: TK_WIDGET_CALLBACKS{ROUT{TK_TEXT_CB}};
tag_str(tags: ARRAY{TK_TEXT_TAG}): STR
const tk_widget_type: STR := "text";

The Sather Home Page