For a more complete description of this Motif widget, consult "OSF/Motif Programmer's Reference."
find_string_value holds the name of a string that you want to search for using the message find_string?
find_direction? specifies the direction that the find_string? message should search. Possible values include XmTEXT_FORWARD (0, the default) and XmTEXT_BACKWARD (1).
x, y are used to convey coordinate information to and from various Text widget functions.
from, to bound the selection. Used to convey selection bounds to and from various Text widget functions.
activate_action, focus_action, losing_focus_action, modify_verify_action, value_changed_action are LYMB callback actions specific to the Text widget. See the XmText man page for details.
read! reads the contents of the file named by the filename instance variable into the Text widget, replacing its current contents. It is the programmer's responsibility to ensure that the file is readable. No error recovery is performed by this message.
write! writes the contents of the Text widget to the file named by the filename instance variable. It is the
programmer's responsibility to ensure that the file is writable. No error recovery is performed by this message.
xy= (x,y) Sets the x and y instance variables simultaneously. Shorthand for x=x xy=y.
baseline? returns the x position of the first baseline.
clear_selection! clears the primary selection in the Text widget.
copy! copies the primary selection to the clipboard.
cut! copies the primary selection to the clipboard and deletes the selected text.
disable_redisplay! delays the display of changes to the text until the message enable_redisplay! is received.
enable_redisplay! enables the display of changes to the text.
find_string? returns the position of the string in the instance variable find_string_value If the search fails, this will return -1. The search starts from the position specified by the instance variable from and proceeds in the direction find_direction. Note that the first position is position 0.
last_position? returns the last character position of the Text widget.
selection? returns the value of the primary selection.
selection_position? returns the first and last positions of the primary selection.
source? returns the source of the Text widget. See XmTextGetSource(3X) for more details.
substring? returns the substring between (inclusive) positions specified by the instance variables from and to. Note that the first position is position 0.
top_character? returns the position of the first character currently displayed.
insert: (pos, string) inserts string into the Text widget at position pos.
paste! inserts the clipboard position at the insertion cursor.
position_of_xy? returns the character position nearest to the current x and y instance variables.
xy_of_position: pos computes the (x,y) position of character position pos. The x and y instance variables are set.
remove! deletes the primary selection.
replace: string replaces the contents of the Text widget between the from and to instance variables with string.
scroll: lines scrolls the Text widget by lines lines. A positive value causes the text to scroll up, negative down.
add_mode_on! enables Add Mode. In Add Mode, the insertion cursor can be moved without disturbing the primary selection.
add_mode_off! disables Add Mode. In Add Mode, the insertion cursor can be moved without disturbing the primary selection.
highlight: mode highlights the text between the from and to instance variables using mode. Mode can be one of XmHIGHLIGHT_NORMAL, XmHIGHLIGHT_SELECTED, or XmHIGHLIGHT_SECONDARY_SELECTED.
set_selection! sets the primary selection based upon the curren from and to instance variables.
set_source: sets the source of the Text widget. See XmTextGetSource(3X) for more details.
top_character: pos sets the position of the first character displayed to pos.
show_position: pos forces text at position pos to be displayed.
string = string_to_display sets the value of the character string to be displayed by the text widget. While the string can also be set by the value resource, using the string= method is the preferred manner to set the string.
string? returns the current value of the character string displayed in the text widget.
@ resource selects resource for a subsequent set or query.
: value sets the current resource to value. Since most resources have mixed case, you should enclose any resource name in quotes. Resource names are the Motif names with the XmN prefix removed. Some resources can only be set before the widget is created. For efficiency, set as many resources as you can before creation.
scalar_value? returns the value of the current resource whose type is integer.
string_value? returns the value of the current resource whose type is string.
pointer_value? returns the value of the current resource whose type is a pointer of any kind.
create! creates an instance of the widget. Any resources that have been specified prior to the create! will be set. An id? message also sends a create!.
on! realizes the widget. Realizing a widget creates its windows and displays it when it is managed.
scalar new: false = 0; scalar new: true = 1;
motif application=`Motif_text Example' ;
motif_form new: form parent=motif create! ;
actions new: activate_text1 tick_actions=`! (1) activate' ;
actions new: losing_focus_text1 tick_actions=`! (1) losing focus' ;
actions new: focus_text1 tick_actions=`! (1) focus' ;
actions new: value_changed_text1 tick_actions=`! (1) value changed' ;
actions new: modify_verify_text1 tick_actions=`! (1) modify verify' ;
motif_text new: text_1 parent=form @ `topAttachment' : XmATTACH_FORM @ `columns' : 80 @ `editable' : true @ `editMode' : XmSINGLE_LINE_EDIT @ `value' : `No File' activate_action=`activate_text1' losing_focus_action=`losing_focus_text1' focus_action=`focus_text1' value_changed_action=`value_changed_text1' modify_verify_action=`modify_verify_text1' create! ;
motif_scrolled_text new: text_2 parent=form @ `topAttachment' : XmATTACH_WIDGET @ `topWidget' : [text_1 id?] @ `columns' : 80 @ `rows' : 20 @ `editable' : false
@ `editMode' : XmMULTI_LINE_EDIT activate_action=`activate_text2' losing_focus_action=`losing_focus_text2' focus_action=`focus_text2' create! ;
actions new: activate_text2 tick_actions=`! (2) activate' ;
actions new: losing_focus_text2 tick_actions=`! (2) losing focus' ;
actions new: focus_text2 tick_actions=`! (2) focus' ;
actions new: exit tick_actions=`motif exit!' ;
motif_row_column new: pb_rc parent=`form' @ `topAttachment' : XmATTACH_WIDGET @ `topWidget' : [text_2 id?] @ `numColumns' : 8 @ `orientation' : XmHORIZONTAL create! ;
motif_push_button new: read_pb parent=pb_rc @ `labelString' : `Read File' activate_action=`read_action' create! ;
motif_push_button new: prepend_pb parent=pb_rc @ `labelString' : `Prepend Text' activate_action=prepend create! ;
motif_push_button new: append_pb parent=pb_rc @ `labelString' : `Append Text' activate_action=append create! ;
motif_push_button new: scroll_up_pb
parent=pb_rc @ `labelString' : `Scroll Up' activate_action=scroll_up create! ;
motif_push_button new: scroll_down_pb parent=pb_rc @ `labelString' : `Scroll Down' activate_action=scroll_down create! ;
motif_push_button new: exit_pb parent=pb_rc @ `labelString' : `Exit' activate_action=exit create! ;
actions new: append tick_actions=` text_1 insert:([text_1 last_position?], `>>>') show_position: [text_1 last_position?] ; ' ;
actions new: prepend tick_actions=` text_1 insert:(0, `<<') show_position: 0 ; ' ;
actions new: scroll_up tick_actions=` text_2 scroll: -10; ' ;
actions new: scroll_down tick_actions=` text_2 scroll: 10; ' ;
actions new: read_action tick_actions=`fsb on!;' ;
actions new: read_file tick_actions=` text_2 @ `editable' : true filename= [fsb @ `dirSpec' string_value?] read! @ `editable' : false ; text_1 @ `value' : [fsb @ `dirSpec' string_value?] ; fsb off!; ' ;
motif_file_selection_dialog new: fsb parent=`motif' create! ;
motif_push_button_gadget new: pbg parent=`fsb' activate_action=`read_file' id= [fsb ok_button_id?] ;
motif on! start!;