StaticText(3W) UNIX System V StaticText(3W)
NAME
StaticText - displays read-only text
SYNOPSIS
#include <Intrinsic.h>
#include <StringDefs.h>
#include <OpenLook.h>
#include <StaticText.h>
widget = XtCreateWidget(name, staticTextWidgetClass, ...);
DESCRIPTION
The StaticText widget provides a way to present an uneditable block of
text using a few simple layout controls.
Word Wrapping
If the text is too long to fit in the width provided by the StaticText
widget, the text may be "wrapped" if the application requests it. The
wrapping occurs at a space between words, if possible, leaving as many
words on a line as will fit. If a word is too long for the width, it is
wrapped between characters. An embedded newline will always cause a
wrap.
Text Clipping-In Width
If the text is not wrapped, it will be truncated if it cannot fit in the
width of the StaticText widget. The application can choose whether the
truncation occurs on the left, right, or evenly on both sides of each
line of the text.
Text Clipping-In Height
If the text is too large to fit in the height provided by the StaticText
widget, the text is clipped on the bottom. The clipping falls on a pixel
boundary, not between lines, so that it is possible that only the upper
part of the last line of text may be visible.
Stripping of Spaces
The application can choose to have leading spaces, trailing spaces, or
both leading and trailing space stripped from the text before display, or
can choose to have no stripping done.
Selecting and Operating on the Text
The StaticText widget allows text to be selected in several ways and then
copied. See Text Selection earlier in this manual for the description of
these operations.
Coloration
When the user uses keyboard traversal to navigate to a StaticText widget,
the active text caret is displayed at the beginning of the text or at its
last position if it has been moved. The caret's color is the
XtNinputFocusColor. The caret is removed when the input focus leaves the
10/89 Page 1
StaticText(3W) UNIX System V StaticText(3W)
StaticText widget.
Figure 1 illustrates the resources that affect the coloration of the
StaticText widget.
Figure 1. Static Text Coloration
Keyboard Traversal
The default value of the XtNtraversalOn resource is False.
The widget responds to the following keyboard navigation keys:
- NEXT_FIELD moves to the next traversable widget in the window
- PREV_FIELD moves to the previous traversable widget in the window
- NEXTWINDOW moves to the next window in the application
- PREVWINDOW moves to the previous window in the application
- NEXTAPP moves to the first window in the next application
- PREVAPP moves to the first window in the previous application
Coloration
When the user uses keyboard traversal to navigate to a StaticText widget,
the active text caret is displayed. The caret's color is the
XtNinputFocusColor. The caret is removed when the input focus leaves the
StaticText widget.
Display of Keyboard Mnemonic And Accelerator
The StaticText does not have keyboard mnemonic or keyboard accelerator
capabilities.
RESOURCES
__________________________________________________________________________________________
| StaticText Resource Set |
|_____________________|______________________|________________|__________________|________|
| Name | Class | Type | Default | Access|
|_____________________|______________________|________________|__________________|________|
__________________________________________________________________________________________
XtNaccelerator XtCAccelerator String NULL SGI
__________________________________________________________________________________________
XtNacceleratorText XtCAcceleratorText String Dynamic SGI
__________________________________________________________________________________________
XtNalignment XtCAlignment OlDefine OL_LEFT SGI
__________________________________________________________________________________________
XtNancestorSensitive XtCSenstitive Boolean TRUE G*
__________________________________________________________________________________________
XtNbackground XtCBackground Pixel White SGI†
__________________________________________________________________________________________
Page 2 10/89
StaticText(3W) UNIX System V StaticText(3W)
__________________________________________________________________________________________
| StaticText Resource Set |
|_____________________|______________________|________________|__________________|________|
| Name | Class | Type | Default | Access|
|_____________________|______________________|________________|__________________|________|
XtNbackgroundPixmap XtCPixmap Pixmap (none) SGI†
__________________________________________________________________________________________
XtNborderColor XtCBorderColor Pixel Black SGI†
__________________________________________________________________________________________
XtNborderPixmap XtCPixmap Pixmap (none) SGI†
__________________________________________________________________________________________
XtNborderWidth XtCBorderWidth Dimension 0 SGI
__________________________________________________________________________________________
XtNconsumeEvent XtCConsumeEvent XtCallbackList NULL SGI
__________________________________________________________________________________________
XtNdepth XtCDepth int (parent's) GI
__________________________________________________________________________________________
XtNdestroyCallback XtCCallback XtCallbackList NULL SI
__________________________________________________________________________________________
XtNfont XtCFont XFontStruct * (OPEN LOOK font) SI
__________________________________________________________________________________________
XtNfontColor XtCFontColor Pixel (see below) SGI
__________________________________________________________________________________________
XtNforeground XtCForeground Pixel Black SGI†
__________________________________________________________________________________________
XtNgravity XtCGravity OlDefine CenterGravity SGI
__________________________________________________________________________________________
XtNheight XtCHeight OlDefine (calculated) SGI
__________________________________________________________________________________________
XtNinputFocusColor XtCInputFocusColor Pixel Black SGI
__________________________________________________________________________________________
XtNlineSpace XtCLineSpace int 0 SGI
__________________________________________________________________________________________
XtNmappedWhenManaged XtCMappedWhenManaged Boolean TRUE SGI
__________________________________________________________________________________________
XtNmnemonic XtCMnemonic unsigned char NULL SGI
__________________________________________________________________________________________
XtNrecomputeSize XtCRecomputeSize Boolean TRUE SGI
__________________________________________________________________________________________
XtNreferenceName XtCReferenceName String NULL SGI
__________________________________________________________________________________________
XtNreferenceWidget XtCReferenceWidget Widget NULL SGI
__________________________________________________________________________________________
XtNsensitive XtCSensitive Boolean TRUE GI*
__________________________________________________________________________________________
XtNstring XtCString String NULL SGI
__________________________________________________________________________________________
XtNstrip XtCStrip Boolean TRUE SGI
__________________________________________________________________________________________
XtNtraversalOn XtCTraversalOn Boolean FALSE SGI
__________________________________________________________________________________________
XtNuserData XtCUserData XtPointer NULL SGI
10/89 Page 3
StaticText(3W) UNIX System V StaticText(3W)
__________________________________________________________________________________________
| StaticText Resource Set |
|_____________________|______________________|________________|__________________|________|
| Name | Class | Type | Default | Access|
|_____________________|______________________|________________|__________________|________|
|_____________________|______________________|________________|__________________|________|
| XtNwidth | XtCWidth | Dimension | (calculated) | SGI |
|_____________________|______________________|________________|__________________|________|
| XtNwrap | XtCWrap | Boolean | TRUE | SGI |
|_____________________|______________________|________________|__________________|________|
| XtNx | XtCPosition | Position | 0 | SGI |
|_____________________|______________________|________________|__________________|________|
| XtNy | XtCPosition | Position | 0 | SGI |
|_____________________|______________________|________________|__________________|________|
XtNalignment
Range of Values:
OLLEFT/"left"
OLCENTER/"center"
OLRIGHT/"right"
This specifies the alignment to be applied when drawing the text, as
described below:
OLLEFT causes the left sides of the lines to be vertically aligned;
OLCENTER causes the centers of the lines to be vertically aligned;
OLRIGHT causes the right sides of the lines to be vertically aligned.
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)
Default:
value of XtNforeground
Page 4 10/89
StaticText(3W) UNIX System V StaticText(3W)
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
Resources, Section 2.
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
Resources, Section 2.
XtNgravity
Range of Values:
CenterGravity
NorthGravity
SouthGravity
EastGravity
WestGravity
NorthWestGravity
NorthEastGravity
SouthWestGravity
SouthEastGravity
The application can set a width and height to the StaticText widget that
exceeds the size needed to display the string. This resource controls
the use of any extra space with the StaticText widget:
CenterGravity
The string is centered vertically and horizontally in the extra
space.
North The top edge of the string is aligned with the top edge of the
space and centered horizontally.
South The bottom edge of the string is aligned with the bottom edge of
the space and centered horizontally.
East The right edge of the string is aligned with the right edge of
the space and centered vertically.
West The left edge of the string is aligned with the left edge of the
space and centered vertically.
NorthWest
The top and left edges of the string are aligned with the top and
left edges of the space.
10/89 Page 5
StaticText(3W) UNIX System V StaticText(3W)
NorthEast
The top and right edges of the string are aligned with the top
and right edges of the space.
SouthWest
The bottom and left edges of the string are aligned with the
bottom and left edges of the space.
SouthEast
The bottom and right edges of the string are aligned with the
bottom and right edges of the space.
XtNlineSpace
Range of Values:
-100 < XtNlineSpace
This resource controls the amount of space between lines of text. It is
specified as a percentage of the font height, and is the distance between
the baseline of one text line and the top of the next font line. Thus,
the distance between successive text baselines, in percentage of the font
height, is
XtNlineSpace+100
XtNrecomputeSize
Range of Values:
TRUE
FALSE
This resource indicates whether the StaticText widget should calculate
its size and automatically set the XtNheight and XtNwidth resources. If
set to TRUE, the StaticText widget will do normal size calculations that
may cause its geometry to change. If set to FALSE, the StaticText widget
will leave its size alone; this may cause truncation of the visible image
being shown by the StaticText widget if the fixed size is too small, or
may cause centering if the fixed size is too large.
XtNstring
This resource is the string that will be drawn. The string must be null
terminated.
XtNstrip
Range of Values:
TRUE
FALSE
This resource controls the stripping of leading and trailing spaces
during the layout of the text string.
Page 6 10/89
StaticText(3W) UNIX System V StaticText(3W)
______________________________________________________________________
| XtNstrip| XtNalignment| Spaces stripped |
||||
| | OLLEFT | Leading spaces stripped. |
| | _____________|____________________________________________|
| TRUE | OLRIGHT | Trailing spaces stripped. |
| | _____________|____________________________________________|
| | OLCENTER | Both leading and trailing spaces stripped.|
|_________|______________|____________________________________________|
| FALSE | (any) | None. |
|_________|______________|____________________________________________|
XtNwrap
Range of Values:
TRUE
FALSE
This resource controls the wrapping of lines that are too long to fit in
the width of the StaticText widget.
_______________________________________________________________________
| XtNwrap| XtNalignment| Wrap action |
||||
| | OLLEFT | Clipped on the right |
| | _____________|______________________________________________|
| FALSE | OLRIGHT | Clipped on the left |
| | _____________|______________________________________________|
| | OLCENTER | Clipped equally on both left and right |
|________|______________|______________________________________________|
| | | Long text is broken at spaces between words |
| TRUE | (any) | so that each line of the displayed text has |
| | | as many words as can fit. |
|________|______________|______________________________________________|
10/89 Page 7