Text(3W) UNIX System V Text(3W)
NAME
Text - provides an interface for the end-user to enter and edit text
Note: The Text widget is obsolete -- use the TextEdit widget instead.
SYNOPSIS
#include <Intrinsic.h>
#include <StringDefs.h>
#include <OpenLook.h>
#include <Text.h>
widget = XtCreateWidget(name, textWidgetClass, ...);
DESCRIPTION
The Text widget provides a single and multi-line text editor that has
both a customizable user interface and a programmatic interface. It can
be used for single-line string entry, forms entry with verification
procedures, multiple-page document viewing, and full-window editing. It
provides an application with a consistent editing paradigm for entry of
textual data.
The display of the textual data on the screen can be adjusted to scroll,
wrap, or grow automatically as the user reaches the edge of the view of
the text.
The Text widget provides separate callback lists to verify insertion
cursor movement, modification of the text, and leaving the Text widget.
Each of these callbacks provides the verification function with the
widget instance, the event that caused the callback, and a data structure
specific to the verification type. From this information, the function
can verify if the application considers this to be a legitimate state
change and signal the widget whether to continue with the action. The
verification function can also manipulate the widget through the class
methods defined by the Text widget class. The verification callback
lists are explained in detail below.
Editing Capabilities
The Text widget provides the editing capabilities listed in the following
table.
__________________________________________________________________________
Name Editing Action
__________________________________________________________________________
CHARFWD Move the caret forward one character
CHARBAK Move the caret back one character
ROWDOWN Move the caret down one line in the current column
ROWUP Move the caret up one line in the current column
WORDFWD Move the caret forward one word
WORDBAK Move the caret back one word
LINESTART Move the caret to the beginning of the current display line
LINEEND Move the caret to the end of the current display line
DOCSTART Move the caret to the beginning of the source
10/89 Page 1
Text(3W) UNIX System V Text(3W)
| DOCEND | Move the caret to the end of the source |
| DELCHARFWD| Delete the character to the right of the caret |
| DELCHARBAK| Delete the character to the left of the caret |
|___________|_____________________________________________________________|
|___________|____________________________________________________________________|
| Name | Editing Action |
|___________|____________________________________________________________________|
| DELWORDFWD| Delete the word to the right of the caret |
| DELWORDBAK| Delete the word to the left of the caret |
| DELLINEFWD| Delete to the end of the current display line from the caret |
| DELLINEBAK| Delete to the beginning of the current display line from the caret|
|___________|____________________________________________________________________|
This second table displays the virtual expressions and keyboard
equivalents for the editing functions. See VIRTUAL KEY/BUTTON(3W)
earlier in this guide for more information on virtual expressions.
________________________________________________________
| Name | Virtual Expression| Keyboard Equivalents|
|___________|____________________|______________________|
| CHARFWD | charFwdKey | CTRL-F, -> |
| CHARBAK | charBakKey | CTRL-B, <- |
| ROWDOWN | rowDownKey | CTRL-N, ↓ |
| ROWUP | rowUpKey | CTRL-P, ↑ |
| WORDFWD | wordFwdKey | ALT-F, ALT- -> |
| WORDBAK | wordBakKey | ALT-B, ALT- <- |
| LINESTART | lineStartKey | CTRL-A, CTRL- <- |
| LINEEND | lineEndKey | CTRL-E, CTRL- -> |
| DOCSTART | docStartKey | ALT-↑, ALT- < |
| DOCEND | docEndKey | ALT-↓, ALT- > |
| DELCHARFWD| delCharFwdKey | CTRL-D, DELETE |
| DELCHARBAK| delCharBakKey | CTRL-H, BACKSPACE |
| DELWRDFWD | delWordFwdKey | ALT-D |
| DELWORDBAK| delWordBakKey | ALT-H |
| DELLINEFWD| delLineFwdKey | CTRL-K |
| DELLINEBAK| delLineBakKey | ALT-K |
|___________|____________________|______________________|
Hierarchical Text
Text is considered to be hierarchically composed of white space, words,
lines and paragraphs. White space is defined as any non-empty sequence
of the ASCII characters space, tab, linefeed or carriage return (decimal
values of 32, 9, 10, 13, respectively); a word is any non-empty sequence
of characters bounded on both sides by whitespace. A source line is any
(possibly empty) sequence of characters bounded by newline characters; a
display line is any (possibly empty) sequence of characters appearing on
a single screen display line. A source paragraph is any sequence of
characters bounded by sets of two or more adjacent newline characters. A
display paragraph is any (possibly empty) sequence of characters bounded
by newline characters (Note: This is identical to the definition of a
source line.)
Page 2 10/89
Text(3W) UNIX System V Text(3W)
In all cases, the beginning or end of the edit text is an acceptable
bounding element in the previous definitions.
Sizing the Display
When making display decisions, the Text widget first determines whether
all the text will fit in the current display. If it does not, and
growing is enabled, the widget will request a resize from its parent. If
the request is denied or only partially satisfied, no future growth
requests will be made unless there is an intervening resize operation
externally imposed.
If any source line is still too long to fit in the display after growing
is attempted, wrapping is checked. If wrapping is disabled, one display
line is drawn for each source line. If a source line is too long for the
display, it is truncated at the right margin after the last full
character that fits. If wrapping is enabled, a new display line will be
started with the first word that does not fit on the current line. If
the wrap break option is OL_WRAP_ANY, as many characters from that word
as will fit before the right margin are written to the current display
line, then the next character starts at the left margin of the next
display line. If the wrap break option is OL_WRAP_WHITE_SPACE, the line
break is instead made after the first whitespace character that follows
the last full word that does fit on the current display line. If,
however, under white space break, the first full word that does not fit
is also the first word on the line, the wrap break is made as if
OL_WRAP_ANY were selected.
Scrolled Window
The application can decide if the Text widget can have a scrollbar at the
side. With a scrollbar, the end user can move through the text easily.
Without a scrollbar, the Text widget either grows its window, if
possible, to show the complete content, or wraps a long line onto another
line.
The proportion indicators on the scrollbar show how much of the text the
user can see at once, compared with the entire text buffer or file.
As the user enters text, the view will automatically scroll left to keep
the insert point in view, unless the Text widget is operating in a wrap
or grow mode.
Application Callbacks
Three types of verification callbacks are supported by the Text widget:
- one for motion operations, to verify a new insert position;
- one for modifying operations, to verify insertion, deletion or
replacement of text; and
10/89 Page 3
Text(3W) UNIX System V Text(3W)
- one for widget exit, to verify state consistency on loss of focus by the
widget. The call_data value is a pointer to an OlTextVerifyCD
structure. The C data types used here are:
typedef enum {
motionVerify,
modVerify,
leaveVerify
} OlVerifyOpType;
typedef struct {
int firstPos;
int length;
unsigned char *ptr;
} OlTextBlock, *OlTextBlockPtr;
typedef struct {
XEvent *xevent;
OlVerifyOpType operation;
Boolean doit;
OlTextPosition currInsert, newInsert;
OlTextPosition startPos, endPos;
OlTextBlock *text;
} OlTextVerifyCD, *OlTextVerifyPtr;
The elements of an OlTextBlock structure are as follows:
firstPos the offset of the starting character in the text block.
length the size of the text block.
ptr a pointer to the text block.
Before the verification callbacks are issued for any given operation, a
structure of type OlTextVerifyCD is initialized. The initial values are:
xevent for a leave operation, the current event pointer.
operation element of OlVerifyOpType signifying the type of
verification operation.
doit TRUE.
currInsert current position of the insert point.
newInsert for a motion operation, the position the user is attempting
to move the insert point to; otherwise, the same value as
currInsert.
startPos for a modify operation, the beginning position in the
current source of the text about to be deleted or replaced,
or where new text will be inserted. If not a modify
Page 4 10/89
Text(3W) UNIX System V Text(3W)
operation, it will have the same value as currInsert
endPos for a modify operation, the ending position in the current
source of the text about to be deleted or replaced. If no
text is being removed, it will have the same value as
startPos. If not a modify operation, the same value as
currInsert.
text for a modify operation with new text to be inserted, a
pointer to a structure of type OlTextBlock, that references
the text to be inserted. Otherwise, NULL.
It is possible for the client to register more than one callback
procedure for any of these callback types. Since there can be more than
one callback, each verification procedure should first check the doit
field.
On return from the last callback, the Text widget will look at the doit
member of the OlTextVerifyCD structure. If it is false, a callback has
already rejected the operation, so there is no need for further
evaluation. If it is still true, the Text widget will proceed with the
operation; otherwise, it will not. Any user feedback for the rejected
operation is the responsibility of the verification procedure.
Verification callbacks are permitted to modify some of the data in the
OlTextVerifyCD structure. The Text widget will only look at certain
fields on return, though, according to the operation type:
- For a motion operation, only the newInsert position will be looked at.
- For a modify operation, only startPos, endPos, and text will be examined
for changes.
- For a leave operation, no fields will be examined.
There is no mechanism for preventing a verification callback from making
other changes to the editing state through the documented interface, but
the results of such behind-the-back actions are undefined.
Application Access to Text
The Text has several resources that identify entry points that the
application can use to access the internal buffer that the Text widget
manages. For example, if the widget is being used to enter a string, the
program can get a copy of the string (i.e. the internal buffer) with the
function under the resources XtNtextCopyBuffer or XtNtextReadSubString.
Selecting and Copying the Text
Text can be moved or copied to and from the Text widget. See TEXT
SELECTION(3W) earlier in this manual for the description of these
operations.
10/89 Page 5
Text(3W) UNIX System V Text(3W)
Coloration
When this widget receives the input focus, it changes the text caret in
the text field to the active caret.
Figure 1 illustrates the resources that affect the coloration of the Text
widget.
Figure 1. Text Coloration
SUBSTRUCTURE
Vertical Scrollbar component
Names: verticalscrollbar
Class: Scrollbar
See the regular resource list for alternate names used for some key
Scrollbar resources.
RESOURCES
____________________________________________________________________________________________________
| Text Resource Set |
|______________________|_______________________|_____________________|_____________________|________|
| Name | Class | Type | Default | Access|
|______________________|_______________________|_____________________|_____________________|________|
____________________________________________________________________________________________________
XtNancestorSensitive XtCSensitive Boolean TRUE G*
____________________________________________________________________________________________________
XtNbackground XtCBackground Pixel White SGI†
____________________________________________________________________________________________________
XtNbackgroundPixmap XtCPixmap Pixmap (none) SGI†
____________________________________________________________________________________________________
XtNborderColor XtCBorderColor Pixel Black SGI†
____________________________________________________________________________________________________
XtNborderPixmap XtCPixmap Pixmap (none) SGI†
____________________________________________________________________________________________________
XtNborderWidth XtCBorderWidth Dimension 0 SGI
____________________________________________________________________________________________________
XtNbottomMargin XtCMargin Dimension 0 SGI
____________________________________________________________________________________________________
XtNconsumeEvent XtCConsumeEvent XtCallbackList NULL SGI
____________________________________________________________________________________________________
XtNcursorPosition XtCTextPosition OlTextPosition 0 SGI
____________________________________________________________________________________________________
XtNcurrentPage XtCCurrentPage int 1 SGI
____________________________________________________________________________________________________
XtNdepth XtCDepth int (parent's) GI
____________________________________________________________________________________________________
XtNdestroyCallback XtCCallback XtCallbackList NULL SI
____________________________________________________________________________________________________
XtNdisplayPosition XtCTextPosition OlTextPosition 0 SGI
____________________________________________________________________________________________________
XtNeditType XtCEditType OlDefine OL_TEXT_EDIT SGI
Page 6 10/89
Text(3W) UNIX System V Text(3W)
____________________________________________________________________________________________________
| Text Resource Set |
|______________________|_______________________|_____________________|_____________________|________|
| Name | Class | Type | Default | Access|
|______________________|_______________________|_____________________|_____________________|________|
____________________________________________________________________________________________________
XtNfile XtCFile String NULL SGI
____________________________________________________________________________________________________
XtNfont XtCFont XFontStruct * (OPEN LOOK font) SI
____________________________________________________________________________________________________
XtNfontColor XtCFontColor Pixel Black* SGI
____________________________________________________________________________________________________
XtNforeground XtCForeground Pixel Black SGI†
____________________________________________________________________________________________________
XtNgrow XtCGrow OlDefine OL_GROW_OFF SGI
____________________________________________________________________________________________________
XtNhorizontalSB XtCHorizontalSB Boolean FALSE SGI
____________________________________________________________________________________________________
XtNinputFocusColor XtCInputFocusColor Pixel Black SGI
____________________________________________________________________________________________________
XtNleaveVerification XtCCallback XtCallbackList NULL SI
____________________________________________________________________________________________________
XtNleftMargin XtCMargin Dimension 0 SGI
____________________________________________________________________________________________________
XtNmappedWhenManaged XtCMappedWhenManaged Boolean TRUE SGI
____________________________________________________________________________________________________
XtNmaximumSize XtCLength int (none) SGI
____________________________________________________________________________________________________
XtNmodifyVerification XtCCallback XtCallbackList NULL SI
____________________________________________________________________________________________________
XtNmotionVerification XtCCallback XtCallbackList NULL SI
____________________________________________________________________________________________________
XtNrecomputeSize XtCRecomputeSize Boolean TRUE SGI
____________________________________________________________________________________________________
XtNrightMargin XtCMargin Dimension 0 SGI
____________________________________________________________________________________________________
XtNsensitive XtCSensitive Boolean TRUE SGI
____________________________________________________________________________________________________
XtNshowPage XtCShowPage OlDefine OL_NONE SGI
____________________________________________________________________________________________________
XtNsourceType XtCSourceType OlDefine OL_STRING_SRC SGI
____________________________________________________________________________________________________
XtNstring XtCString String NULL SGI
____________________________________________________________________________________________________
XtNtextClearBuffer XtCTextClearBuffer void(*)() (n/a) G
____________________________________________________________________________________________________
XtNtextCopyBuffer XtCTextCopyBuffer unsigned char(*)() (n/a) G
____________________________________________________________________________________________________
XtNtextGetInsertPoint XtCTextGetInsertPoint OlTextPosition(*)() (n/a) G
____________________________________________________________________________________________________
XtNtextGetLastPos XtCTextGetLastPos OlTextPosition(*)() (n/a) G
____________________________________________________________________________________________________
10/89 Page 7
Text(3W) UNIX System V Text(3W)
____________________________________________________________________________________________________
| Text Resource Set |
|______________________|_______________________|_____________________|_____________________|________|
| Name | Class | Type | Default | Access|
|______________________|_______________________|_____________________|_____________________|________|
| XtNtextInsert | XtCTextInsert | void(*)() | (n/a) | G |
|______________________|_______________________|_____________________|_____________________|________|
| XtNtraversalOn | XtCTraversalOn | Boolean | TRUE | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNtextReadSubStr | XtCTextReadSubStr | int(*)() | (n/a) | G |
|______________________|_______________________|_____________________|_____________________|________|
| XtNtextRedraw | XtCTextRedraw | void(*)() | (n/a) | G |
|______________________|_______________________|_____________________|_____________________|________|
| XtNtextReplace | XtCTextReplace | int | (n/a) | G |
|______________________|_______________________|_____________________|_____________________|________|
| XtNtextSetInsertPoint| XtCTextSetInsertPoint| void(*)() | (n/a) | G |
|______________________|_______________________|_____________________|_____________________|________|
| XtNtextUpdate | XtCTextUpdate | void(*)() | (n/a) | G |
|______________________|_______________________|_____________________|_____________________|________|
| XtNtopMargin | XtCMargin | Dimension | 0 | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNtraversalOn | XtCTraversalOn | Boolean | TRUE | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNuserData | XtCUserData | XtPointer | NULL | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNverticalSB | XtCVerticalSB | Boolean | FALSE | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNviewHeight | XtCViewHeight | Dimension | (calculated) | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNwidth | XtCWidth | Dimension | (calculated) | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNwrap | XtCWrap | Boolean | TRUE | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNwrapBreak | XtCWrapBreak | OlDefine | OL_WRAP_WHITE_SPACE| SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNx | XtCPosition | Position | 0 | SGI |
|______________________|_______________________|_____________________|_____________________|________|
| XtNy | XtCPosition | Position | 0 | SGI |
|______________________|_______________________|_____________________|_____________________|________|
XtNbottomMargin
Range of Values:
0 < XtNbottomMargin
This resource is the number of pixels used for the bottom margin.
XtNcursorPosition
Range of Values:
0 < XtNcursorPosition < (current size of the text)
Page 8 10/89
Text(3W) UNIX System V Text(3W)
This resource is the position in the text source of the insert cursor.
XtNdisplayPosition
Range of Values:
0 < XtNdisplayPosition
This resource contains the position in the text source that will be
displayed at the top of the screen. A value of 0 indicates the start of
the text source.
Note:
The specified position must correspond to the first character position of
a source line (i.e., it must be 0, or it must be a position immediately
following a newline character). Otherwise, correct behavior is not
guaranteed.
XtNeditType
Range of Values:
OL_TEXT_READ/"read"
OL_TEXT_EDIT/"edit"
This resource controls the edit state of the source:
OL_TEXT_READ The source is read-only; the end user cannot edit it.
OL_TEXT_EDIT The source is fully editable.
Note:
This option is available for text buffers only; text files cannot be
edited.
XtNfile
This resource is used only if the XtNsourceType resource has the value
OL_DISK_SOURCE. It is the absolute pathname of a disk file to be viewed.
XtNfont
Range of Values:
(any valid return from XLoadQueryFont())
Default:
(chosen to match the scale and screen resolution)
This resource identifies the font to be used to display the text.
The default value points to a cached font structure; an application
should not expect to get this value with a call to XtGetValues() and use
it reliably thereafter.
XtNfontColor
Range of Values:
10/89 Page 9
Text(3W) UNIX System V Text(3W)
(any Pixel value valid for the current display)/(any name from the
rgb.txt file)
This resource specifies the color for the font. If not set, the color
from the XtNforeground resource, if available, is used for the font.
See the note about the interaction of this resource with other color
resources under the description of the XtNbackground resource in
CORE(3W).
XtNforeground
This resource defines the foreground color for the widget.
See the note about the interaction of this resource with other color
resources under the description of the XtNbackground resource in
CORE(3W).
XtNgrow
Range of Values:
OL_GROW_OFF/"off"
OL_GROW_HORIZONTAL/"horizontal"
OL_GROW_VERTICAL/"vertical"
OL_GROW_BOTH/"both"
This resource controls if the widget will try to resize its window when
it needs more height or width to display the text:
OL_GROW_OFF It will not resize itself.
OL_GROW_HORIZONTAL
It will attempt to change its width when lines are too
long for the current screen width.
OL_GROW_VERTICAL
it will attempt to resize its height when the number of
text lines is greater than can be displayed with the
current screen height.
OL_GROW_BOTH It will attempt resizes in both dimensions.
XtNverticalSB
Range of Values:
TRUE
FALSE
These resources determine if the Text widget will have a scrollbar along
the side.
Page 10 10/89
Text(3W) UNIX System V Text(3W)
XtNleaveVerification
This is the callback list used when the input focus leaves the Text
widget. The call_data parameter is a pointer to an OlTextVerifyCD
structure described earlier in TEXT.
XtNleftMargin
Range of Values:
0 < XtNleftMargin
This resource is the number of pixels used for the left margin.
XtNmaximumSize
Range of Values:
0 < XtNmaximumSize
This resource is used only if the XtNsourceType resource has the value
OL_STRING_SOURCE. It is the maximum number of characters that can be
entered into the internal buffer. If this value is not set, then the
internal buffer will increase its size as needed, limited only by the
space limitations of the process.
XtNmodifyVerification
This callback list is called before text is deleted from or inserted into
the text source. The call_data parameter is a pointer to an
OlTextVerifyCD structure described earlier.
XtNmotionVerification
This callback list is called before the insertion cursor is moved to a
new position. The call_data parameter is a pointer to an OlTextVerifyCD
structure described earlier in TEXT.
XtNrecomputeSize
Range of Values:
TRUE
FALSE
This resource indicates whether the Text widget should calculate its size
and automatically set the XtNheight and XtNwidth resources. If set to
TRUE, the Text widget will do normal size calculations that may cause its
geometry to change. If set to FALSE, the Text widget will leave its size
alone.
This resource is ignored for each dimension that has an associated
scrollbar.
XtNrightMargin
Range of Values:
10/89 Page 11
Text(3W) UNIX System V Text(3W)
0 < XtNrightMargin
This resource is the number of pixels used for the right margin.
XtNshowPage
This resource is directed to the vertical scrollbar in the Text widget.
See SCROLLBAR for more detail.
XtNsourceType
Range of Values:
OL_STRING_SOURCE/"stringsrc"
OL_DISK_SOURCE/"disksrc"
This resource defines the type of the text source.
XtNstring
This resource is used only if the XtNsourceType resource has the value
OL_STRING_SOURCE. This is the string to be viewed and/or edited. A copy
is made into an internal buffer allocated by the Text widget. A call to
XtGetValues() on this resource will return a copy of the internal buffer.
The application program is responsible for freeing the space allocated by
this copy.
XtNtextClearBuffer
Synopsis:
void (*textClearBuffer)();
static Arg query[] = {
{ XtNtextClearBuffer,(XtArgVal)&textClearBuffer }
};
XtGetValues(widget, query, XtNumber(query));
(*textClearBuffer)(w)
Widget w;
This function clears the internal buffer. After this call, all
characters in the buffer have been removed.
XtNtextCopyBuffer
Synopsis:
unsigned char *(*textCopyBuffer)(), *buf;
static Arg query[] = {
{ XtNtextCopyBuffer, (XtArgVal)&textCopyBuffer }
};
XtGetValues(widget, query, XtNumber(query));
buf = (*textCopyBuffer)(w)
Widget w;
This function uses XtMalloc() to create space for copying the internal
buffer and returns the pointer to that copy. The application is
Page 12 10/89
Text(3W) UNIX System V Text(3W)
responsible for freeing the space.
XtNtextGetInsertPoint
Synopsis:
OlTextPosition (*textGetInsertPoint)(), pos;
static Arg query[] = {
{ XtNtextGetInsertPoint,(XtArgVal)&textGetInsertPoint }
};
XtGetValues(widget, query, XtNumber(query));
pos = (*textGetInsertPoint)(w)
Widget w;
This function returns the insertion position.
XtNtextGetLastPos
Synopsis:
OlTextPosition (*textGetLastPos)(), pos;
static Arg query[] = {
{ XtNtextGetLastPos, (XtArgVal)&textGetLastPos }
};
XtGetValues(widget, query, XtNumber(query));
pos = (*textGetLastPos)(w, lastPos)
Widget w;
OltextPosition lastPos;
This function returns the last character position in the buffer.
XtNtextInsert
Synopsis:
void (*textInsert)();
static Arg query[] = {
{ XtNtextInsert, (XtArgVal)&textInsert }
};
XtGetValues(widget, query, XtNumber(query));
(*textInsert)(w, string)
Widget w;
unsigned char *string;
This function inserts the string at the current insertion position and
advances the insertion position to the end of the string.
10/89 Page 13
Text(3W) UNIX System V Text(3W)
XtNtextReadSubString
Synopsis:
int (*textReadSubString)();
static Arg query[] = {
{ XtNtextReadSubString,(XtArgVal)&textReadSubString }
};
XtGetValues(widget, query, XtNumber(query));
(*textReadSubString)(w,startpos,endpos,target,tsize,tused)
Widget w;
OltextPosition startpos, endpos;
unsigned char *target;
int tsize, *tused;
This function will move characters from the buffer into the caller's
space. The caller must provide the space to copy into and its size in
bytes. The routine will return the number of positions moved. The value
of tused returns the number of bytes used in the target string by the
move.
XtNtextRedraw
Synopsis:
void (*textRedraw)();
static Arg query[] = {
{ XtNtextRedraw, (XtArgVal)&textRedraw }
};
XtGetValues(widget, query, XtNumber(query));
(*textRedraw)(w);
Widget w;
This function refreshes the widget's window.
XtNtextReplace
Synopsis:
OlEditResult (*textReplace)(), result;
static Arg query[] = {
{ XtNtextReplace, (XtArgVal)&textReplace }
};
XtGetValues(widget, query, XtNumber(query));
result = (*textReplace)(w, startPos, endPos, text)
Widget w;
OltextPosition startPos, endPos;
unsigned char *text;
This function removes text in the source from startPos to endPos and
inserts the string text starting at startPos. If startPos and endPos are
the same, the action is an insertion. If text is the empty string, the
action is a deletion.
XtNtextSetInsertPoint
Synopsis:
Page 14 10/89
Text(3W) UNIX System V Text(3W)
void (*textSetInsertPoint)();
static Arg query[] = {
{ XtNtextSetInsertPoint, (XtArgVal)&textSetInsertPoint }
};
XtGetValues(widget, query, XtNumber(query));
(*textSetInsertPoint)(w, position)
Widget w;
OltextPosition position;
This function sets the insertion point.
XtNtextUpdate
Synopsis:
void (*textUpdate)();
static Arg query[] = {
{ XtNtextUpdate, (XtArgVal)&textUpdate }
};
XtGetValues(widget, query, XtNumber(query));
(*textUpdate)(w, status)
Widget w;
Boolean status;
This function turns the widget's screen updating function on and off. If
the application needs to make a sequence of source change calls, a call
to OlTextUpdate(FALSE) will prevent screen flash. After the sequence of
calls the application calls OlTextUpdate(TRUE) to update the window and
resume normal updating. Note that it is not necessary to turn off
updating for functions that only get values from the widget, nor is it
necessary to turn it off if the application only makes one call that
changes the widget.
XtNtopMargin
Range of Values:
0 < XtNtopMargin
This resource is the number of pixels used for the top margin.
XtNviewHeight
Range of Values:
0 < XtNviewHeight
This resource gives the preferred height, in lines, of the text pane. If
a nonzero value is given, the corresponding XtNheight resource is
computed by converting this number to pixels and adding the thickness of
any scrollbar and border that appears. In this case, any value in the
XtNheight resource is overwritten.
If a zero value is given in the XtNviewHeight resource, the XtNheight
resource is used as an estimate. The text pane is sized to show an
integral number of lines, such that the overall height of the Text widget
is less than or equal to XtNheight, if possible. However, the text pane
10/89 Page 15
Text(3W) UNIX System V Text(3W)
is always large enough to show at least one line and is no shorter than
the minimum scroll bar size.
If neither the XtNviewHeight resource nor the XtNheight resource is set,
or both are set to zero, the text pane is made as small as possible,
limited as described above.
XtNtraversalOn
Range of Values:
TRUE
FALSE
This resource specifies whether this widget is selectable during
traversal.
XtNwrap
Range of Values:
TRUE
FALSE
This resource specifies how the widget displays lines longer than the
screen width. When set to FALSE, the lines may extend off screen to the
right. When set to TRUE, the lines will be wrapped at the right margin,
with the position determined by the resource XtNwrapBreak.
XtNwrapBreak
Range of Values:
OL_WRAP_ANY/"wrapany"
OL_WRAP_WHITE_SPACE/"wrapwhitespace"
This resource specifies how the wrap position is determined. When set to
OL_WRAP_ANY, the wrap will happen at the character position closest to
the right margin. When set to OL_WRAP_WHITE_SPACE, the wrap will happen
at the last white space before the right margin. If the line does not
have white space, it will be wrapped as OL_WRAP_ANY.
SEE ALSO
TextEdit Widget(3W)
Page 16 10/89