Manual pages › OPEN LOOK widgets (3W)
olText(3W)
Text
From the original Amiga UNIX 2.1 manual. Some things it mentions may not be in this release.
WIDGET CLASS NAME · SYNOPSIS · DESCRIPTION · SUBSTRUCTURE · RESOURCES
WIDGET CLASS NAME
Text
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, multiplepage 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 | | 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 | | 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 key- board 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, v | | 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-v, 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 nonempty 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.) 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 posi-
tion;
- one for modifying operations, to verify insertion, dele-
tion or replacement of text; and
- 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 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.
Keyboard Traversal Users can traverse among Text and Text-Field widgets within any ancestor ControlArea, Bulletin-Board, or Form widget using the NEXTFIELD and PREVFIELD keys:
- NEXTFIELD moves the caret to the next traversable Text or TextField widget in the managing ancestor widget. When the caret is in the last traversable field, NEXTFIELD moves the caret to the first traversable field.
- PREVFIELD moves the caret to the previous traversable field in the managing ancestor widget. When the caret is in the first traversable field, PREVFIELD moves the caret to the last traversable field. The default key mappings for NEXTFIELD and PREVFIELD are TAB and SHIFT-TAB, respectively. A user may change these defaults through the appropriate Workspace Properties window.
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.
Text Coloration 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 |
|______________________|______________________|________________|__________________|________|
|_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 |
|______________________|______________________|________________|__________________|________|
|_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 |
|______________________|______________________|________________|__________________|________|
|_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___|
| XtNreferenceWidget | XtCReferenceWidget | Widget | (Widget)0 | GI |
|______________________|______________________|________________|__________________|________|
|_XtNrightMargin_______|__XtCMargin___________|__Dimension_____|__0_______________|__SGI___|
____________________________________________________________________________________________________
|_____________________________________Text_Resource_Set_(cont.)_____________________________________|
| Name | Class | Type | Default | Access|
|______________________|_______________________|_____________________|_____________________|________|
| 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_____|
| XtNtextInsert | XtCTextInsert | void(*)() | (n/a) | G |
|______________________|_______________________|_____________________|_____________________|________|
|_XtNtextReadSubStr____|__XtCTextReadSubStr____|__int(*)()___________|__(n/a)______________|__G_____|
| XtNtextRedraw | XtCTextRedraw | void(*)() | (n/a) | G |
|______________________|_______________________|_____________________|_____________________|________|
|_XtNtextReplace_______|__XtCTextReplace_______|__OlEditResult(*)()__|__(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)
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 charac-
ter position of a source line (i.e., it must be 0, or it
must be a position immediately following a newline charac-
ter). 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:
(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.
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.
XtNreferenceWidget
This resource specifies a position for inserting the current widget in its managing ancestor's traversal list. If the reference widget is non-null and exists in the managing ancestor's traversal list, the current widget will be inserted in front of it. Otherwise, the current widget will be inserted at the end of the list.
XtNrightMargin
Range of Values:
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 XtGet-Values() 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 appli-
cation is 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 posi-
tion and advances the insertion position to the end of the
string.
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:
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 updat-
ing. Note that it is not necessary to turn off updating for
functions that only get values from the widget, nor is it neces-
sary 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 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.
Growing, Wrapping, Scrolling The XtNgrow, XtNwrap, and
XtNverticalSB resources are used to control how the view of
the text is adjusted as new text is inserted. Assuming the
insertion would cause the current view to be too small to
show all the text, the following table explains what hap-
pens. A "yes" in the first column means that XtNgrow allows
growing in the affected direction; a "no" means it does not.
A "yes" in the second column means that the XtNverticalSB
resource is TRUE.
____________________________________________________________
_XtNgrow___Can_scroll?___XtNwrap___Affect___________________
TRUE
yes _________ grow if can, else scroll
________________FALSE_____________________________
yes TRUE
no _________ grow if can, else clip
__________________________FALSE_____________________________
TRUE wrap
yes ____________________________________
________________FALSE____scroll___________________
TRUE wrap
no ____________________________________
__________________________FALSE____clip_____________________
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| no | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |