Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

TEXT WIDGET(3W)  —  OLIT

WIDGET CLASS NAME

Text

SYNOPSIS

#include <Intrinsic.h>
#include <Intrinsic.h>
#include <StringDefs.h>
#include <OpenLook.h>
#include <Text.h>

widget = XtCreateWidget(name, textWidgetClass, ...);
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.  NameEditing 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 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       META-F, META- → WORDBAK     wordBakKey       META-B, META- ← LINESTART   lineStartKey     CTRL-A, CTRL- ← LINEEND     lineEndKey       CTRL-E, CTRL- → DOCSTART    docStartKey      META-↑, META- < DOCEND      docEndKey        META-↓, META- > DELCHARFWD  delCharFwdKey    CTRL-D, DELETE DELCHARBAK  delCharBakKey    CTRL-H, BACKSPACE DELWRDFWD   delWordFwdKey    META-D DELWORDBAK  delWordBakKey    META-H DELLINEFWD  delLineFwdKey    CTRL-K DELLINEBAK  delLineBakKey    META-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.) 

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, 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, 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 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

—one for widget exit, to verify state consistency on loss of focus by the widget.  The call_data call_data value is a pointer to an OlTextVerifyCD OlTextVerifyCD structure.  The C data types used here are:

typedef enum {
typedef enum {
        motionVerify,
        modVerify,
        leaveVerify
} OlVerifyOpType;
typedef struct {
typedef struct {
        int              firstPos;
        int              length;
        unsigned char    ∗ptr;
} OlTextBlock, ∗OlTextBlockPtr;
typedef struct {
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 The elements of an OlTextBlock structure are as follows:

firstPos

firstPosthe offset of the starting character in the text block. 

length

lengththe size of the text block. 

ptr

ptra pointer to the text block. 

Before the verification callbacks are issued for any given operation, a structure of type OlTextVerifyCD OlTextVerifyCD is initialized.  The initial values are:

xevent

xeventfor a leave operation, the current event pointer. 

operation

operation
element of OlVerifyOpType OlVerifyOpType signifying the type of verification operation. 

doit

doitTRUE.  TRUE. 

currInsert

currInsert
current position of the insert point.

newInsert

newInsert
for a motion operation, the position the user is attempting to move the insert point to; otherwise, the same value as currInsert.  currInsert. 

startPos

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 currInsert

endPos

endPosfor 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.  startPos.  If not a modify operation, the same value as currInsert. 

text

textfor a modify operation with new text to be inserted, a pointer to a structure of type OlTextBlock, 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 doit field. 

On return from the last callback, the Text widget will look at the doit doit member of the OlTextVerifyCD 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 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 newInsert position will be looked at. 

—For a modify operation, only startPos, startPos, endPos, endPos, and text 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 XtNtextCopyBuffer or XtNtextReadSubString.  XtNtextReadSubString.  Keyboard Traversal

Users can traverse among Text and TextField widgets within any ancestor ControlArea, BulletinBoard, 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

the diagram Text Coloration illustrates the resources that affect the coloration of the Text widget. 

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            Type     Default   Access
 XtNancestorSensitive         Boolean        TRUE       G∗
        XtNbackground           Pixel       White  SGI†
  XtNbackgroundPixmap          Pixmap      (none)  SGI†
       XtNborderColor           Pixel       Black  SGI†
      XtNborderPixmap          Pixmap      (none)  SGI†
       XtNborderWidth       Dimension           0      SGI
      XtNbottomMargin       Dimension           0      SGI
    XtNcursorPosition  OlTextPosition           0      SGI
       XtNcurrentPage             int           1      SGI
             XtNdepth             int  (parent’s)       GI
   XtNdestroyCallback  XtCallbackList        NULL       SI
   XtNdisplayPosition  OlTextPosition           0      SGI
              XtNfile          String        NULL      SGI
              XtNfont   XFontStruct ∗  (OPEN LOOK font)       SI
         XtNfontColor           Pixel      Black∗      SGI
        XtNforeground           Pixel       Black  SGI†
      XtNhorizontalSB         Boolean       FALSE      SGI
 XtNleaveVerification  XtCallbackList        NULL       SI
        XtNleftMargin       Dimension           0      SGI
 XtNmappedWhenManaged         Boolean        TRUE      SGI
       XtNmaximumSize             int      (none)      SGI XtNmodifyVerification  XtCallbackList        NULL       SI XtNmotionVerification  XtCallbackList        NULL       SI
     XtNrecomputeSize         Boolean        TRUE      SGI
   XtNreferenceWidget          Widget   (Widget)0       GI
       XtNrightMargin       Dimension           0      SGI
Text Resource Set (cont.)
                 Name                 Type       Default  Access
         XtNsensitive              Boolean          TRUE     SGI
            XtNstring               String          NULL     SGI
   XtNtextClearBuffer            void(∗)()         (n/a)       G
    XtNtextCopyBuffer   unsigned char(∗)()         (n/a)       G XtNtextGetInsertPoint  OlTextPosition(∗)()         (n/a)       G
    XtNtextGetLastPos  OlTextPosition(∗)()         (n/a)       G
        XtNtextInsert            void(∗)()         (n/a)       G
    XtNtextReadSubStr             int(∗)()         (n/a)       G
        XtNtextRedraw            void(∗)()         (n/a)       G
       XtNtextReplace    OlEditResult(∗)()         (n/a)       G XtNtextSetInsertPoint            void(∗)()         (n/a)       G
        XtNtextUpdate            void(∗)()         (n/a)       G
         XtNtopMargin            Dimension             0     SGI
       XtNtraversalOn              Boolean          TRUE     SGI
          XtNuserData            XtPointer          NULL     SGI
        XtNverticalSB              Boolean         FALSE     SGI
        XtNviewHeight            Dimension  (calculated)     SGI
             XtNwidth            Dimension  (calculated)     SGI
              XtNwrap              Boolean          TRUE     SGI
                 XtNx             Position             0     SGI
                 XtNy             Position             0     SGI

XtNbottomMargin

Range of Values:

0 ≤ XtNbottomMargin
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) 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 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_READ/"read"
OL_TEXT_EDIT/"edit"
OL_TEXT_EDIT/"edit"

This resource controls the edit state of the source:

OL_TEXT_READ

OL_TEXT_READ
The source is read-only; the end user cannot edit it.

OL_TEXT_EDIT

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 XtNsourceType resource has the value OL_DISK_SOURCE.  OL_DISK_SOURCE.  It is the absolute pathname of a disk file to be viewed.  XtNfont

Range of Values:

(any valid return from XLoadQueryFont()) (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() 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) (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 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 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 XtNbackground resource in CORE(3W).  XtNgrow

Range of Values:

OL_GROW_OFF/"off"
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

OL_GROW_OFF
It will not resize itself.

OL_GROW_HORIZONTAL

OL_GROW_HORIZONTAL
It will attempt to change its width when lines are too long for the current screen width.

OL_GROW_VERTICAL

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

OL_GROW_BOTH
It will attempt resizes in both dimensions.

XtNverticalSB

Range of Values:

TRUE
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 call_data parameter is a pointer to an OlTextVerifyCD OlTextVerifyCD structure described earlier in TEXT.  XtNleftMargin

Range of Values:

0 ≤ XtNleftMargin
0 ≤ XtNleftMargin

This resource is the number of pixels used for the left margin.  XtNmaximumSize

Range of Values:

0 ≤ XtNmaximumSize
0 ≤ XtNmaximumSize

This resource is used only if the XtNsourceType XtNsourceType resource has the value OL_STRING_SOURCE.  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 call_data parameter is a pointer to an OlTextVerifyCD OlTextVerifyCD structure described earlier.  XtNmotionVerification

This callback list is called before the insertion cursor is moved to a new position.  The call_data call_data parameter is a pointer to an OlTextVerifyCD OlTextVerifyCD structure described earlier in TEXT.  XtNrecomputeSize

Range of Values:

TRUE
TRUE
FALSE

This resource indicates whether the Text widget should calculate its size and automatically set the XtNheight XtNheight and XtNwidth XtNwidth resources.  If set to TRUE, TRUE, the Text widget will do normal size calculations that may cause its geometry to change.  If set to FALSE, 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
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_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 XtNsourceType resource has the value OL_STRING_SOURCE.  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() 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:
Synopsis:

void (∗textClearBuffer)();
void (∗textClearBuffer)();
static Arg query[] = {
static Arg query[] = {
        { XtNtextClearBuffer,(XtArgVal)&textClearBuffer }
};
XtGetValues(widget, query, XtNumber(query));
(∗textClearBuffer)(w)
(∗textClearBuffer)(w)
Widget w;

This function clears the internal buffer.  After this call, all characters in the buffer have been removed.  XtNtextCopyBuffer

Synopsis:
Synopsis:

unsigned char ∗(∗textCopyBuffer)(), ∗buf;
unsigned char ∗(∗textCopyBuffer)(), ∗buf;
static Arg query[] = {
static Arg query[] = {
        { XtNtextCopyBuffer, (XtArgVal)&textCopyBuffer }
};
XtGetValues(widget, query, XtNumber(query));
buf = (∗textCopyBuffer)(w)
buf = (∗textCopyBuffer)(w)
Widget w;

This function uses XtMalloc() XtMalloc() to create space for copying the internal buffer and returns the pointer to that copy.  The application is responsible for freeing the space.  XtNtextGetInsertPoint

Synopsis:
Synopsis:

OlTextPosition (∗textGetInsertPoint)(), pos;
OlTextPosition (∗textGetInsertPoint)(), pos;
static Arg query[] = {
static Arg query[] = {
        { XtNtextGetInsertPoint,(XtArgVal)&textGetInsertPoint }
};
XtGetValues(widget, query, XtNumber(query));
pos = (∗textGetInsertPoint)(w)
pos = (∗textGetInsertPoint)(w)
Widget w;

This function returns the insertion position.  XtNtextGetLastPos

Synopsis:
Synopsis:

OlTextPosition  (∗textGetLastPos)(), pos;
OlTextPosition  (∗textGetLastPos)(), pos;
static Arg query[] = {
static Arg query[] = {
        { XtNtextGetLastPos, (XtArgVal)&textGetLastPos }
};
XtGetValues(widget, query, XtNumber(query));
pos = (∗textGetLastPos)(w, lastPos)
pos = (∗textGetLastPos)(w, lastPos)
Widget w;
OltextPosition lastPos;

This function returns the last character position in the buffer.  XtNtextInsert

Synopsis:
Synopsis:

void (∗textInsert)();
void (∗textInsert)();
static Arg query[] = {
static Arg query[] = {
        { XtNtextInsert, (XtArgVal)&textInsert }
};
XtGetValues(widget, query, XtNumber(query));
(∗textInsert)(w, string)
(∗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.  XtNtextReadSubString

Synopsis:
Synopsis:

int (∗textReadSubString)();
int (∗textReadSubString)();
static Arg query[] = {
static Arg query[] = {
        { XtNtextReadSubString,(XtArgVal)&textReadSubString }
};
XtGetValues(widget, query, XtNumber(query));
(∗textReadSubString)(w,startpos,endpos,target,tsize,tused)
(∗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 tused returns the number of bytes used in the target string by the move.  XtNtextRedraw

Synopsis:
Synopsis:

void (∗textRedraw)();
void (∗textRedraw)();
static Arg query[] = {
static Arg query[] = {
        { XtNtextRedraw, (XtArgVal)&textRedraw }
};
XtGetValues(widget, query, XtNumber(query));
(∗textRedraw)(w);
(∗textRedraw)(w);
Widget w;

This function refreshes the widget’s window.  XtNtextReplace

Synopsis:
Synopsis:

OlEditResult (∗textReplace)(), result;
OlEditResult (∗textReplace)(), result;
static Arg query[] = {
static Arg query[] = {
        { XtNtextReplace, (XtArgVal)&textReplace }
};
XtGetValues(widget, query, XtNumber(query));
result = (∗textReplace)(w, startPos, endPos, text)
result = (∗textReplace)(w, startPos, endPos, text)
Widget w;
OltextPosition startPos, endPos;
unsigned char ∗text;

This function removes text in the source from startPos startPos to endPos endPos and inserts the string text starting at text starting at startPos.  startPos.  If startPos startPos and endPos endPos are the same, the action is an insertion.  If text is the empty string, If text is the empty string, the action is a deletion.  XtNtextSetInsertPoint

Synopsis:
Synopsis:

void (∗textSetInsertPoint)();
void (∗textSetInsertPoint)();
static Arg query[] = {
static Arg query[] = {
        { XtNtextSetInsertPoint, (XtArgVal)&textSetInsertPoint }
};
XtGetValues(widget, query, XtNumber(query));
(∗textSetInsertPoint)(w, position)
(∗textSetInsertPoint)(w, position)
Widget w;
OltextPosition position;

This function sets the insertion point.  XtNtextUpdate

Synopsis:
Synopsis:

void (∗textUpdate)();
void (∗textUpdate)();
static Arg query[] = {
static Arg query[] = {
        { XtNtextUpdate, (XtArgVal)&textUpdate }
};
XtGetValues(widget, query, XtNumber(query));
(∗textUpdate)(w, status)
(∗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) OlTextUpdate(FALSE) will prevent screen flash.  After the sequence of calls the application calls OlTextUpdate(TRUE) 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
0 ≤ XtNtopMargin

This resource is the number of pixels used for the top margin.  XtNviewHeight

Range of Values:

0 ≤ XtNviewHeight
0 ≤ XtNviewHeight

This resource gives the preferred height, in lines, of the text pane.  If a nonzero value is given, the corresponding XtNheight 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 XtNheight resource is overwritten.  If a zero value is given in the XtNviewHeight XtNviewHeight resource, the XtNheight 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, 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 XtNviewHeight resource nor the XtNheight 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
TRUE
FALSE

This resource specifies whether this widget is selectable during traversal.  XtNwrap

Range of Values:

TRUE
TRUE
FALSE

This resource specifies how the widget displays lines longer than the screen width.  When set to FALSE, FALSE, the lines may extend off screen to the right.  When set to TRUE, TRUE, the lines will be wrapped at the right margin, with the position determined by the resource XtNwrapBreak.  XtNwrapBreak.  XtNwrapBreak

Range of Values:

OL_WRAP_ANY/"wrapany"
OL_WRAP_ANY/"wrapany"
OL_WRAP_WHITE_SPACE/"wrapwhitespace"

This resource specifies how the wrap position is determined.  When set to OL_WRAP_ANY, OL_WRAP_ANY, the wrap will happen at the character position closest to the right margin.  When set to OL_WRAP_WHITE_SPACE, 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.  OL_WRAP_ANY.  Growing, Wrapping, Scrolling

The XtNgrow, XtNgrow, XtNwrap, XtNwrap, and XtNverticalSB 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 happens.  A "yes" in the first column means that XtNgrow 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.  XtNverticalSB resource is TRUE.  XtNgrow  XtNwrap   Affect
    yes     TRUE  grow if can, else scroll
         FALSE      
          TRUE  grow if can, else clip
         FALSE      
     no     TRUE     wrap
         FALSE   scroll
          TRUE     wrap
         FALSE     clip

Sun Release 4.0  —  Last change: 1/8/90

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026