XmText(library call) XmText(library call)
NAME [Toc] [Back]
XmText - The Text widget class
SYNOPSIS [Toc] [Back]
#include <Xm/Text.h>
DESCRIPTION [Toc] [Back]
Text provides a single-line and multiline text editor for customizing
both user and programmatic interfaces. It can be used for single-line
string entry, forms entry with verification procedures, and fullwindow
editing. It provides an application with a consistent editing
system for textual data. The screen's textual data adjusts to the
application writer's needs.
Text provides separate callback lists to verify movement of the insert
cursor, modification of the text, and changes in input focus. 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 can signal the widget whether to continue with the action.
The user interface tailors a new set of translations. The default
translations provide key bindings for insert cursor movement,
deletion, insertion, and selection of text.
Text allows the user to select regions of text. Selection is based on
the model specified in the Inter-Client Communication Conventions
Manual (ICCCM). Text supports primary and secondary selection.
In some Asian languages, texts are drawn vertically. Also, some
characters are displayed with 90-degree clockwise rotation, and other
characters are mapped to vertical glyphs that differ from the normal
horizaontal glyphs. Information about which characters require
rotation or mapping to vertical glyphs is specified in the X Locale
Database (NLS databases) and handled by X library, depending on
XNOrientation XOC values. XmText widget should also handle the
vertically aligned lines as for editing, entering, or selecting texts.
The vertical writing feature of the XmText widget is enabled when the
XmTOP_TO_BOTTOM value is specified for the XmNlayoutDirection resource
of the XmText widget. In that case, the horizontal scroll bar is
displayed on the bottom of the XmText widget and the vertical scroll
bar is displayed on the left side.
Mouse Selection [Toc] [Back]
The Text widget allows text to be edited, inserted, and selected. The
user can cut, copy, and paste text by using the clipboard, primary
transfer, or secondary transfer. Text also provides a Drag and Drop
facility that enables the user to copy or move data within Text or to
a different widget. When keyboard focus policy is set to EXPLICIT,
- 1 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
the widget that receives focus is the destination widget. In POINTER
mode, any keyboard or mouse operation (except secondary selection) in
an editable widget establishes that widget as the destination.
If a destination widget becomes insensitive or uneditable, it forfeits
its destination status. In EXPLICIT mode, when a widget becomes
insensitive, the focus moves to another widget. If that widget is
editable, it becomes the destination widget; otherwise, there is no
destination widget. The text of any insensitive Text widget is
stippled, indicating its state to the user.
The insertion cursor, displayed as an I-beam, shows where input is
inserted. Input is inserted just before the insertion cursor.
Text uses the XmQTnavigator, XmQTspecifyRenderTable, and
XmQTscrollFrame traits, and holds the XmQTaccessTextual and
XmQTtransfer traits. The widget checks its parent for the
XmQTscrollFrame trait. If this trait does not exist, then the widget
has no scrolling. If the trait does exist, and the ScrollFrame widget
has not been initialized, the widget creates two navigators and sets
up the scrollbars.
If an application or widget calls the setValue trait method of
XmQTaccessTextual, then XmText will call XmTextSetString to set the
string value.
Classes [Toc] [Back]
Text inherits behavior, resources, and traits from Core and
XmPrimitive.
The class pointer is xmTextWidgetClass.
The class name is XmText.
Data Transfer Behavior [Toc] [Back]
Text supports transfer of the primary, secondary, and clipboard
selections and dragging of selected text from the widget. Text can
also be the destination for the primary, secondary, and clipboard
selections, and it supports dropping of data being dragged onto the
widget.
When the XmNconvertCallback procedures are called, the location_data
member of the XmConvertCallbackStruct member is NULL if the selected
text is being transferred. If the entire text, not the selected text,
is being transferred, the value of this member is the widget ID of the
Text widget.
As a source of data, Text supports the following targets and
associated conversions of data to these targets:
- 2 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
locale If the locale target matches the widget's locale, the widget
transfers the selected text in the encoding of the locale.
COMPOUND_TEXT [Toc] [Back]
The widget transfers the selected text as type
COMPOUND_TEXT.
STRING The widget transfers the selected text as type STRING.
TEXT If the selected text is fully convertible to the encoding of
the locale, the widget transfers the selected text in the
encoding of the locale. Otherwise, the widget transfers the
selected text as type COMPOUND_TEXT.
DELETE The widget deletes the selected text.
_MOTIF_CLIPBOARD_TARGETS
The widget transfers, as type ATOM, a list of the targets to
which the widget can convert data to be placed on the
clipboard immediately. If the selected text is fully
convertible to STRING, these include STRING; otherwise, they
include COMPOUND_TEXT.
_MOTIF_DEFERRED_CLIPBOARD_TARGETS
The widget transfers, as type ATOM, a list of the targets it
supports for delayed transfer for the CLIPBOARD selection.
This widget currently supplies no targets for
_MOTIF_DEFERRED_CLIPBOARD_TARGETS.
_MOTIF_EXPORT_TARGETS
The widget transfers, as type ATOM, a list of the targets to
be used as the value of the DragContext's XmNexportTargets
in a drag-and-drop transfer. These include COMPOUND_TEXT,
the encoding of the locale, STRING, TEXT, BACKGROUND, and
FOREGROUND.
_MOTIF_LOSE_SELECTION
The widget takes the following actions:
+ When losing the PRIMARY selection, it unhighlights the
selected text and calls the XmNlosePrimaryCallback
procedures.
+ When losing the SECONDARY selection, it removes the
secondary selection highlight.
+ When losing the _MOTIF_DESTINATION selection, if the
widget does not have focus, it changes the cursor to
indicate that the widget is no longer the destination.
- 3 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
As a source of data, Text also supports the following standard Motif
targets:
BACKGROUND [Toc] [Back]
The widget transfers XmNbackground as type PIXEL.
CLASS The widget finds the first shell in the widget hierarchy
that has a WM_CLASS property and transfers the contents as
text in the current locale.
CLIENT_WINDOW [Toc] [Back]
The widget finds the first shell in the widget hierarchy and
transfers its window as type WINDOW.
COLORMAP The widget transfers XmNcolormap as type COLORMAP.
FOREGROUND [Toc] [Back]
The widget transfers XmNforeground as type PIXEL.
NAME The widget finds the first shell in the widget hierarchy
that has a WM_NAME property and transfers the contents as
text in the current locale.
TARGETS The widget transfers, as type ATOM, a list of the targets it
supports. These include the standard targets in this list.
These also include COMPOUND_TEXT, the encoding of the
locale, STRING, and TEXT.
TIMESTAMP The widget transfers the timestamp used to acquire the
selection as type INTEGER.
_MOTIF_RENDER_TABLE
The widget transfers XmNrenderTable if it exists, or else
the default text render table, as type STRING.
_MOTIF_ENCODING_REGISTRY
The widget transfers its encoding registry as type STRING.
The value is a list of NULL separated items in the form of
tag encoding pairs. This target symbolizes the transfer
target for the Motif Segment Encoding Registry. Widgets and
applications can use this Registry to register text encoding
formats for specified render table tags. Applications
access this Registry by calling XmRegisterSegmentEncoding
and XmMapSegmentEncoding.
As a destination for data, Text chooses a target and requests
conversion of the selection to that target. If the encoding of the
locale is present in the list of available targets, Text chooses a
requested target from the available targets in the following order of
preference:
- 4 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
1. The encoding of the locale
2. TEXT
3. COMPOUND_TEXT
4. STRING
If the encoding of the locale is not present in the list of available
targets, Text chooses a requested target from the available targets in
the following order of preference:
1. COMPOUND_TEXT
2. STRING
New Resources [Toc] [Back]
The following table defines a set of widget resources used by the
programmer to specify data. The programmer can also set the resource
values for the inherited classes to set attributes for this widget. To
reference a resource by name or by class in a .Xdefaults file, remove
the XmN or XmC prefix and use the remaining letters. To specify one of
the defined values for a resource in a .Xdefaults file, remove the Xm
prefix and use the remaining letters (in either lowercase or
uppercase, but include any underscores between words). The codes in
the access column indicate if the given resource can be set at
creation time (C), set by using XtSetValues (S), retrieved by using
XtGetValues (G), or is not applicable (N/A).
XmText Resource Set
Name Class Type Default Access
XmNactivateCallback XmCCallback XtCallbackList NULL C
XmNautoShowCursorPosition XmCAutoShowCursorPosition Boolean True CSG
XmNcursorPosition XmCCursorPosition XmTextPosition 0 CSG
XmNcursorPositionVisible XmCCursorPositionVisible Boolean dynamic CSG
XmNdestinationCallback XmCCallback XtCallbackList NULL C
XmNeditable XmCEditable Boolean True CSG
XmNeditMode XmCEditMode int XmSINGLE_LINE_EDIT CSG
XmNfocusCallback XmCCallback XtCallbackList NULL C
XmNgainPrimaryCallback XmCCallback XtCallbackList NULL C
XmNlosePrimaryCallback XmCCallback XtCallbackList NULL C
XmNlosingFocusCallback XmCCallback XtCallbackList NULL C
XmNmarginHeight XmCMarginHeight Dimension 5 CSG
XmNmarginWidth XmCMarginWidth Dimension 5 CSG
XmNmaxLength XmCMaxLength int largest integer CSG
XmNmodifyVerifyCallback XmCCallback XtCallbackList NULL C
XmNmodifyVerifyCallbackWcs XmCCallback XtCallbackList NULL C
XmNmotionVerifyCallback XmCCallback XtCallbackList NULL C
XmtotalLines XmCTotalLines int dynamic C
XmNsource XmCSource XmTextSource Default source CSG
XmNtopCharacter XmCTopCharacter XmTextPosition 0 CSG
XmNvalue XmCValue String "" CSG
- 5 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
XmNvalueChangedCallback XmCCallback XtCallbackList NULL C
XmNvalueWcs XmCvalueWcs wchar_t * (wchar_t *)"" CSG1
XmNverifyBell XmCVerifyBell Boolean dynamic CSG
1 This resource cannot be set in a resource file.
XmNactivateCallback [Toc] [Back]
Specifies the list of callbacks that is called when the user
invokes an event that calls the activate() action. The type
of the structure whose address is passed to this callback is
XmAnyCallbackStruct. The reason sent by the callback is
XmCR_ACTIVATE.
XmNautoShowCursorPosition [Toc] [Back]
Ensures that the visible text contains the insert cursor
when set to True. If the insert cursor changes, the
contents of Text may scroll in order to bring the insertion
point into the window. Setting this resource to False,
however, does not ensure that Text will not scroll.
XmNcursorPosition [Toc] [Back]
Indicates the position in the text where the current insert
cursor is to be located. Position is determined by the
number of characters from the beginning of the text. The
first character position is 0 (zero).
XmNcursorPositionVisible [Toc] [Back]
If the widget has an XmPrintShell as one of its ancestors,
then the default value is False; otherwise, it is True.
XmNdestinationCallback [Toc] [Back]
Specifies a list of callbacks called when the widget is the
destination of a transfer operation. The type of the
structure whose address is passed to these callbacks is
XmDestinationCallbackStruct. The reason is XmCR_OK.
XmNeditable [Toc] [Back]
When set to True, indicates that the user can edit the text
string. Prohibits the user from editing the text when set
to False.
When XmNeditable is used on a widget it sets the dropsite to
XmDROP_SITE_ACTIVE.
XmNeditMode [Toc] [Back]
Specifies the set of keyboard bindings used in Text. The
default, XmSINGLE_LINE_EDIT, provides the set of key
bindings to be used in editing single-line text.
XmMULTI_LINE_EDIT provides the set of key bindings to be
used in editing multiline text.
- 6 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
The results of placing a Text widget inside a ScrolledWindow
when the Text's XmNeditMode is XmSINGLE_LINE_EDIT are
undefined.
XmNfocusCallback [Toc] [Back]
Specifies the list of callbacks called when Text accepts
input focus. The type of the structure whose address is
passed to this callback is XmAnyCallbackStruct. The reason
sent by the callback is XmCR_FOCUS.
XmNgainPrimaryCallback [Toc] [Back]
Specifies the list of callbacks called when an event causes
the Text widget to gain ownership of the primary selection.
The reason sent by the callback is XmCR_GAIN_PRIMARY.
XmNlosePrimaryCallback [Toc] [Back]
Specifies the list of callbacks called when an event causes
the Text widget to lose ownership of the primary selection.
The reason sent by the callback is XmCR_LOSE_PRIMARY.
XmNlosingFocusCallback [Toc] [Back]
Specifies the list of callbacks called before Text loses
input focus. The type of the structure whose address is
passed to this callback is XmTextVerifyCallbackStruct. The
reason sent by the callback is XmCR_LOSING_FOCUS.
XmNmarginHeight [Toc] [Back]
Specifies the distance between the top edge of the widget
window and the text, and between the bottom edge of the
widget window and the text.
XmNmarginWidth [Toc] [Back]
Specifies the distance between the left edge of the widget
window and the text, and between the right edge of the
widget window and the text.
XmNmaxLength [Toc] [Back]
Specifies the maximum length of the text string that can be
entered into text from the keyboard. This value must be
nonnegative. Strings that are entered by using the XmNvalue
resource or the XmTextSetString function ignore this
resource.
XmNmodifyVerifyCallback [Toc] [Back]
Specifies the list of callbacks called before text is
deleted from or inserted into Text. The type of the
structure whose address is passed to this callback is
XmTextVerifyCallbackStruct. The reason sent by the callback
is XmCR_MODIFYING_TEXT_VALUE. When multiple Text widgets
share the same source, only the widget that initiates the
source change will generate XmNmodifyVerifyCallback.
- 7 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
If both XmNmodifyVerifyCallback and
XmNmodifyVerifyCallbackWcs are registered callback lists,
the procedure(s) in the XmNmodifyVerifyCallback list is
always executed first; and the resulting data, which may
have been modified, is passed to the
XmNmodifyVerifyCallbackWcs callback routines.
XmNmodifyVerifyCallbackWcs [Toc] [Back]
Specifies the list of callbacks called before text is
deleted from or inserted into Text. The type of the
structure whose address is passed to this callback is
XmTextVerifyCallbackStructWcs. The reason sent by the
callback is XmCR_MODIFYING_TEXT_VALUE. When multiple Text
widgets share the same source, only the widget that
initiates the source change will generate the
XmNmodifyVerifyCallbackWcs.
If both XmNmodifyVerifyCallback and
XmNmodifyVerifyCallbackWcs are registered callback lists,
the procedure(s) in the XmNmodifyVerifyCallback list is
always executed first; and the resulting data, which may
have been modified, is passed to the
XmNmodifyVerifyCallbackWcs callback routines.
XmNmotionVerifyCallback [Toc] [Back]
Specifies the list of callbacks called before the insert
cursor is moved to a new position. The type of the
structure whose address is passed to this callback is
XmTextVerifyCallbackStruct. The reason sent by the callback
is XmCR_MOVING_INSERT_CURSOR. It is possible for more than
one XmNmotionVerifyCallback to be generated from a single
action.
XmNsource Specifies the source with which the widget displays text.
If no source is specified, the widget creates a default
string source. This resource can be used to share text
sources between Text widgets.
XmNtopCharacter [Toc] [Back]
Displays the position of text at the top of the window.
Position is determined by the number of characters from the
beginning of the text. The first character position is 0
(zero).
If the XmNeditMode is XmMULTI_LINE_EDIT, the line of text
that contains the top character is displayed at the top of
the widget without shifting the text left or right.
XtGetValues for XmNtopCharacter returns the position of the
first character in the line that is displayed at the top of
the widget.
- 8 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
XmNtotalLines [Toc] [Back]
Indicates the number of lines in the text widget buffer (not
necessarily visible). The initial value 1 means the text
buffer is empty. The number of lines reported takes into
account the wordWrap policy (that is, it's not simply the
number of newline characters.
XmNvalue Specifies the string value of the Text widget as a char*
data value. Moves the cursor to position 0 unless a value
of XmNcursorPosition was explicitly supplied in the argument
list. If XmNvalue and XmNvalueWcs are both defined, the
value of XmNvalueWcs supersedes that of XmNvalue.
XtGetValues returns a copy of the value of the internal
buffer and XtSetValues copies the string values into the
internal buffer.
XmNvalueChangedCallback [Toc] [Back]
Specifies the list of callbacks called after text is deleted
from or inserted into Text. The type of the structure whose
address is passed to this callback is XmAnyCallbackStruct.
The reason sent by the callback is XmCR_VALUE_CHANGED. When
multiple Text widgets share the same source, only the widget
that initiates the source change will generate the
XmNvalueChangedCallback. This callback represents a change
in the source in the Text, not in the Text widget. The
XmNvalueChangedCallback should occur only in pairs with an
XmNmodifyVerifyCallback, assuming that the doit flag in the
callback structure of the XmNmodifyVerifyCallback is not set
to False.
XmNvalueWcs [Toc] [Back]
Specifies the string value of the Text widget as a wchar_t*
data value. Moves the cursor to position 0 unless a value
of XmNcursorPosition was explicitly supplied in the argument
list.
This resource cannot be specified in a resource file.
If XmNvalue and XmNvalueWcs are both defined, the value of
XmNvalueWcs supersedes that of XmNvalue. XtGetValues
returns a copy of the value of the internal buffer encoded
as a wide character string. XtSetValues copies the value of
the wide character string into the internal buffer.
XmNverifyBell [Toc] [Back]
Specifies whether the bell should sound when the
verification returns without continuing the action. The
default depends on the value of the ancestor VendorShell's
XmNaudibleWarning resource.
- 9 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
______________________________________________________________________________________
| XmText Input Resource Set |
|Name Class Type Default Access |
|XmNpendingDelete XmCPendingDelete Boolean True CSG |
|XmNselectionArray XmCSelectionArray XtPointer default array CSG |
|XmNselectionArrayCount XmCSelectionArrayCount int 4 CSG |
|XmNselectThreshold XmCSelectThreshold int 5 CSG |
|_____________________________________________________________________________________|
XmNpendingDelete [Toc] [Back]
Indicates that pending delete mode is on when the Boolean
value is True. Pending deletion is defined as deletion of
the selected text when an insertion is made.
XmNselectionArray [Toc] [Back]
Defines the actions for multiple mouse clicks. The value of
the resource is an array of XmTextScanType elements.
XmTextScanType is an enumeration indicating possible
actions. Each mouse click performed within some time of the
previous mouse click increments the index into this array
and performs the defined action for that index. (This
"multiclick" time is specified by the operating environment,
and varies among different systems. In general, it is
usually set to some fraction of a second.) The possible
actions in the order they occur in the default array are as
follows:
3. XmSELECT_POSITION, which resets the insert cursor
position.
4. XmSELECT_WORD, which selects a word.
5. XmSELECT_LINE, which selects a line of text. This
action sees a line as delimited by hard newline
characters. In other words, if the word wrap feature
is on (XmNwordWrap is True), this will ignore the
newlines automatically inserted by the widget. This is
the default.
6. XmSELECT_OUT_LINE, which selects a line of text. This
action sees a line as delimited by hard or soft
newline characters. In other words, if the word wrap
feature is on (XmNwordWrap is True), the newlines
automatically inserted by the widget will be treated
as delimiting lines.
7. XmSELECT_ALL, which selects all of the text.
XmNselectionArrayCount [Toc] [Back]
Indicates the number of elements in the XmNselectionArray
resource. The value must not be negative.
- 10 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
XmNselectThreshold [Toc] [Back]
Specifies the number of pixels of motion that is required to
select the next character when selection is performed using
the click-drag mode of selection. The value must not be
negative. This resource also specifies whether a drag
should be started and the number of pixels to start a drag
when Btn2Down and Btn1Down are integrated.
________________________________________________________________________________________
| XmText Output Resource Set |
|Name Class Type Default Access |
|XmNblinkRate XmCBlinkRate int 500 CSG |
|XmNcolumns XmCColumns short dynamic CSG |
|XmNcursorPositionVisible XmCCursorPositionVisible Boolean True CSG |
|XmNfontList XmCFontList XmFontList dynamic CSG |
|XmNrenderTable XmCRenderTable XmRenderTable dynamic CSG |
|XmNresizeHeight XmCResizeHeight Boolean False CSG |
|XmNresizeWidth XmCResizeWidth Boolean False CSG |
|XmNrows XmCRows short dynamic CSG |
|XmNwordWrap XmCWordWrap Boolean False CSG |
|_______________________________________________________________________________________|
XmNblinkRate [Toc] [Back]
Specifies the blink rate of the text cursor in milliseconds.
The time indicated in the blink rate relates to the time the
cursor is visible and the time the cursor is invisible (that
is, the time it takes to blink the insertion cursor on and
off is twice the blink rate). The cursor does not blink when
the blink rate is set to 0 (zero). The value must not be
negative.
XmNcolumns [Toc] [Back]
Specifies the initial width of the text window as an integer
number of characters. The width equals the number of
characters specified by this resource multiplied by the
width as derived from the specified font. If the em-space
value is available, it is used. If not, the width of the
numeral "0" is used. If this is not available, the maximum
width is used. For proportionate fonts, the actual number
of characters that fit on a given line may be greater than
the value specified. The value must be greater than 0
(zero). The default value depends on the value of the
XmNwidth resource. If no width is specified the default is
20.
When the XmNlayoutDirection resource is XmTOP_TO_BOTTOM, and
if the XmText widget resource XmNeditMode is
XmSINGLE_LINE_EDIT, this attribute is ignored. If no width
is specified, the default is 1.
XmNcursorPositionVisible [Toc] [Back]
Indicates that the insert cursor position is marked by a
- 11 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
text cursor when the Boolean value is True.
XmNfontList [Toc] [Back]
Specifies the font list to be used for Text. The font list
is an obsolete structure and is retained only for
compatibility with earlier releases of Motif. Use the render
table (XmNrenderTable) instead of font lists wherever
possible. If both are specified, the render table will take
precedence. If this value is NULL at initialization, the
parent hierarchy of the widget is searched for an ancestor
that holds the XmQTspecifyRenderTable trait. If such an
ancestor is found, the font list is initialized to the
XmTEXT_RENDER_TABLE value of the ancestor widget. If no such
ancestor is found, the default is implementation dependent.
Text searches the font list for the first occurrence of a
font set that has XmFONTLIST_DEFAULT_TAG. If a default
element is not found, the first font set in the font list is
used. If the list contains no font sets, the first font in
the font list will be used. Refer to XmFontList(3) for more
information on a font list structure.
XmNrenderTable [Toc] [Back]
Specifies the render table to be used in deriving a font set
or font for rendering text. If both a render table and a
font list are specified, the render table will take
precedence. If the value of XmNrenderTable is NULL at
initialization, the parent hierarchy of the widget is
searched for an ancestor that holds the
XmQTspecifyRenderTable trait. If such an ancestor is found,
the font list is initialized to the XmTEXT_RENDER_TABLE
value of the ancestor widget. If no such ancestor is found,
the default is implementation dependent.
Text searches the render table for the first occurrence of a
rendition that has the tag _MOTIF_DEFAULT_LOCALE. If a
default element is not found, the first rendition in the
table is used. Refer to XmRenderTable(3) for more
information on the render table structure.
XmNresizeHeight [Toc] [Back]
Indicates that Text will attempt to resize its height to
accommodate all the text contained in the widget when the
Boolean value is True. If the Boolean value is set to True,
the text is always displayed, starting from the first
position in the source, even if instructed otherwise. This
attribute is ignored when the application uses a Text widget
whose parent is a ScrolledWindow and when XmNscrollVertical
is True.
- 12 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
When the XmNlayoutDirection resource is XmTOP_TO_BOTTOM,
this resource indicates that the text attempts to resize its
height to accommodate all the text contained in the widget
when the Boolean value is True. This attribute is ignored if
XmNwordWrap is True.
XmNresizeWidth [Toc] [Back]
Indicates that Text attempts to resize its width to
accommodate all the text contained in the widget when the
Boolean value is True. This attribute is ignored if
XmNwordWrap is True.
When the XmNlayoutDirection resource is XmTOP_TO_BOTTOM,
this attribute is still effective even if XmNwordWrap is
True. Also, this attribute is ignored when the application
uses a text widget whose parent is a ScrolledWindow and
XmNscrollHorizaontal is True.
XmNrows Specifies the initial height of the text window measured in
character heights. This attribute is ignored if the text
widget resource XmNeditMode is XmSINGLE_LINE_EDIT. The
value must be greater than 0 (zero). The default value
depends on the value of the XmNheight resource. If no
height is specified, the default is 1.
When the XmNlayoutDirection resource is XmTOP_TO_BOTTOM,
this attribute is still effective, even if the XmText widget
resource XmNeditMode is XmSINGLE_LINE_EDIT. If no height is
specified, the default is 20.
XmNwordWrap [Toc] [Back]
Indicates that lines are to be broken at word breaks (that
is, the text does not go off the right edge of the window)
when the Boolean value is True. Words are defined as a
sequence of characters separated by whitespace. Whitespace
is defined as a space, tab, or newline. This attribute is
ignored if the text widget resource XmNeditMode is
XmSINGLE_LINE_EDIT. Note that this resource is only valid
when the widget is not a scroll one, or, if the widget is a
scroll widget, that the XmNscrollHorizontal resource is
False.
Indicates that lines are to be broken at word breaks (that
is, when the XmNlayoutDirection resource is XmTOP_TO_BOTTOM,
the text does not go off the bottom edge of the window) when
the Boolean value is True.
The following resources are used only when text is created in a
ScrolledWindow. See the reference page for XmCreateScrolledText.
- 13 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
__________________________________________________________________
| XmText Scrolling Resource Set |
|Name Class Type Default Access |
|XmNscrollHorizontal XmCScroll Boolean True CG |
|XmNscrollLeftSide XmCScrollSide Boolean False CG |
|XmNscrollTopSide XmCScrollSide Boolean False CG |
|XmNscrollVertical XmCScroll Boolean True CG |
|_________________________________________________________________|
Note in connection with this table that if the XmNlayoutDirection
resource is XmTOP_TO_BOTTOM, the default is True.
XmNscrollHorizontal [Toc] [Back]
Adds a ScrollBar that allows the user to scroll horizontally
through text when the Boolean value is True. This resource
is forced to False when the Text widget is placed in a
ScrolledWindow with XmNscrollingPolicy set to XmAUTOMATIC.
When the XmNlayoutDirection resource is XmTOP_TO_BOTTOM,
this attribute is ignored if the XmText widget resource
XmNeditMode is XmSINGLE_LINE_EDIT.
XmNscrollLeftSide [Toc] [Back]
Indicates that the vertical ScrollBar should be placed on
the left side of the scrolled text window when the Boolean
value is True. This attribute is ignored if
XmNscrollVertical is False or the Text resource XmNeditMode
is XmSINGLE_LINE_EDIT.
When the XmNlayoutDirection resource is XmTOP_TO_BOTTOM,
this resource is still effective, even if the XmText widget
resource XmNeditMode is XmSINGLE_LINE_EDIT.
XmNscrollTopSide [Toc] [Back]
Indicates that the horizontal ScrollBar should be placed on
the top side of the scrolled text window when the Boolean
value is True.
When the XmNlayoutDirection resource is XmTOP_TO_BOTTOM,
this attribute is ignored if XmNscrollHorizontal is False or
the Xmtext resource XmNeditMode is XmSINGLE_LINE_EDIT.
XmNscrollVertical [Toc] [Back]
Adds a ScrollBar that allows the user to scroll vertically
through text when the Boolean value is True. This attribute
is ignored if the Text resource XmNeditMode is
XmSINGLE_LINE_EDIT. This resource is forced to False when
the Text widget is placed in a ScrolledWindow with
XmNscrollingPolicy set to XmAUTOMATIC.
- 14 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
When the XmNlayoutDirection resource is XmTOP_TO_BOTTOM,
this resource is still effective, even if the XmText widget
resource XmNeditMode is XmSINGLE_LINE_EDIT.
Inherited Resources [Toc] [Back]
Text inherits behavior and resources from the superclasses described
in the following tables. For a complete description of each resource,
refer to the reference page for that superclass.
____________________________________________________________________________________________________
| XmPrimitive Resource Set |
|Name Class Type Default Access |
|XmNbottomShadowColor XmCBottomShadowColor Pixel dynamic CSG |
|XmNbottomShadowPixmap XmCBottomShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG |
|XmNconvertCallback XmCCallback XtCallbackList NULL C |
|XmNforeground XmCForeground Pixel dynamic CSG |
|XmNhelpCallback XmCCallback XtCallbackList NULL C |
|XmNhighlightColor XmCHighlightColor Pixel dynamic CSG |
|XmNhighlightOnEnter XmCHighlightOnEnter Boolean False CSG |
|XmNhighlightPixmap XmCHighlightPixmap Pixmap dynamic CSG |
|XmNhighlightThickness XmCHighlightThickness Dimension 2 CSG |
|XmNlayoutDirection XmCLayoutDirection XmDirection dynamic CG |
|XmNnavigationType XmCNavigationType XmNavigationType XmTAB_GROUP CSG |
|XmNpopupHandlerCallback XmCCallback XtCallbackList NULL C |
|XmNshadowThickness XmCShadowThickness Dimension 2 CSG |
|XmNtopShadowColor XmCTopShadowColor Pixel dynamic CSG |
|XmNtopShadowPixmap XmCTopShadowPixmap Pixmap dynamic CSG |
|XmNtraversalOn XmCTraversalOn Boolean True CSG |
|XmNunitType XmCUnitType unsigned char dynamic CSG |
|XmNuserData XmCUserData XtPointer NULL CSG |
|___________________________________________________________________________________________________|
- 15 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
________________________________________________________________________________________________________________
| Core Resource Set |
|Name Class Type Default Access |
|XmNaccelerators XmCAccelerators XtAccelerators dynamic CSG |
|XmNancestorSensitive XmCSensitive Boolean dynamic G |
|XmNbackground XmCBackground Pixel dynamic CSG |
|XmNbackgroundPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG |
|XmNborderColor XmCBorderColor Pixel XtDefaultForeground CSG |
|XmNborderPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG |
|XmNborderWidth XmCBorderWidth Dimension 0 CSG |
|XmNcolormap XmCColormap Colormap dynamic CG |
|XmNdepth XmCDepth int dynamic CG |
|XmNdestroyCallback XmCCallback XtCallbackList NULL C |
|XmNheight XmCHeight Dimension dynamic CSG |
|XmNinitialResourcesPersistent XmCInitialResourcesPersistent Boolean True C |
|XmNmappedWhenManaged XmCMappedWhenManaged Boolean True CSG |
|XmNscreen XmCScreen Screen * dynamic CG |
|XmNsensitive XmCSensitive Boolean True CSG |
|XmNtranslations XmCTranslations XtTranslations dynamic CSG |
|XmNwidth XmCWidth Dimension dynamic CSG |
|XmNx XmCPosition Position 0 CSG |
|XmNy XmCPosition Position 0 CSG |
|_______________________________________________________________________________________________________________|
Callback Information [Toc] [Back]
A pointer to the following structure is passed to each callback:
typedef struct
{
int reason;
XEvent * event;
} XmAnyCallbackStruct;
reason Indicates why the callback was invoked
event Points to the XEvent that triggered the callback
The Text widget defines a new callback structure for use with
verification callbacks. Note that not all fields are relevant for
every callback reason. The application must first look at the reason
field and use only the structure members that are valid for the
particular reason. The values startPos, endPos, and text in the
callback structure XmTextVerifyCallbackStruct may be modified when the
callback is received, and these changes will be reflected as changes
made to the source of the Text widget. (For example, all keystrokes
can be converted to spaces or NULL characters when a password is
entered into a Text widget.) The application programmer should not
overwrite the text field, but should attach data to that pointer.
A pointer to the following structure is passed to callbacks for
XmNlosingFocusCallback, XmNmodifyVerifyCallback, and
- 16 - Formatted: January 24, 2005
XmText(library call) XmText(library call)
XmNmotionVerifyCallback:
typedef struct
{
int reason;
XEvent * event;
Boolean doit;
XmTextPosition currInsert, newInsert;
XmTextPosition startPos, endPos;
XmTextBlock text;
} XmTextVerifyCallbackStruct, *XmTextVerifyPtr;
reason Indicates why the callback was invoked.
event Points to the XEvent that triggered the callback. It can be
NULL. For example, changes made to the Text widget
programmatically do not have an event that can be passed to
the associated callback.
doit Indicates whether the action that invoked the callback is
performed. Setting doit to False negates the action. Note
that not all actions may be negated. For example,
XmCR_LOSING_FOCUS callbacks may be beyond the control of the
widget if they are produced by mouse clicks.
currInsert
Indicates the current position of the insert cursor.
newInsert Indicates the position at which the user attempts to
position the insert cursor.
startPos Indicates the starting position of the text to modify. If
the callback is not a modify verification callback, this
value is the same as currInsert.
endPos Indicates the ending position of the text to modify. If no
text is replaced or deleted, the value is the same as
startPos. If the callback is not a modify verification
callback, this value is the same as currInsert.
text Points to a structure of type XmTextBlockRec. This structure
holds the textual information to be inserted.
typedef struct
{
char *ptr;
int length;
XmTextFormat forma
|