DwtCSText(3Dwt)
Name
DwtCSText, DwtCSTextCreate − Creates a compound-string text widget.
Syntax
Widget DwtCSText(parent_widget, name, x, y, cols, rows, value)
Widget parent_widget;
char *name;
Position x, y;
Dimension cols, rows;
DwtCompString value;
Widget DwtCSTextCreate (parent_widget, name,
override_arglist, override_argcount)
Widget parent_widget;
char *name;
ArgList override_arglist;
int override_argcount;
Arguments
parent_widget
Specifies the parent widget ID.
nameSpecifies the name of the created widget.
xSpecifies the placement, in pixels, of the left side of the widget window relative to the inner upper left corner of the parent window. This argument sets the DwtNx core widget attribute.
ySpecifies, in pixels, the placement of the top of the widget window relative to the inner upper left corner of the parent window. This argument sets the DwtNy core widget attribute.
colsSpecifies the width of the text window measured in character cells. This argument sets the DwtNcols attribute associated with DwtCSTextCreate.
rowsSpecifies the height of the text window measured in character cells or number of lines. This argument sets the DwtNrows attribute associated with DwtCSTextCreate.
valueSpecifies the text contents of the compound-string text widget. This argument sets the DwtNvalue attribute associated with DwtCSTextCreate.
override_arglist
Specifies the application override argument list.
override_argcount
Specifies the number of attributes in the application override argument list (override_arglist).
Description
The DwtCSText and DwtCSTextCreate functions create an instance of a compound-string text widget and return its associated widget ID. When calling DwtCSText, you set the compound-string text widget attributes presented in the formal parameter list. For DwtCSTextCreate, however, you specify a list of attribute name/value pairs that represent all the possible compound-string text widget attributes. The compound-string text widget enables the application to display a single or multiline field of text for input and editing by the user. By default the text window expands or shrinks as the user enters or deletes text characters. Note that the text window does not shrink below the initial size set at creation time.
The compound-string text widget does not support children; therefore, there is no geometry or resize semantics.
Inherited Attributes
| Attribute Name | Data Type | Default |
| Core Attributes | ||
| DwtNx | Position | Determined by the geometry manager |
| DwtNy | Position | Determined by the geometry manager |
| DwtNwidth | Dimension | Set as large as necessary to display the DwtNrows and DwtNcols with the specified DwtNmarginWidth and DwtNmarginHeight |
| DwtNheight | Dimension | Set as large as necessary to display the DwtNcols and DwtNrows with the specified DwtNmarginHeight and DwtNmarginWidth |
| DwtNborderWidth | Dimension | One pixel |
| DwtNborder | Pixel | Default foreground color |
| DwtNborderPixmap | Pixmap | NULL |
| DwtNbackground | Pixel | Default background color |
| DwtNbackgroundPixmap | Pixmap | NULL |
| DwtNcolormap | Colormap | Default color map |
| DwtNsensitive | Boolean | True |
| DwtNancestorSensitive | Boolean | The bitwise AND of the parent widget’s DwtNsensitive and DwtNancestorSensitive attributes |
| DwtNaccelerators | XtTranslations | NULL |
| DwtNdepth | int | Depth of the parent window |
| DwtNtranslations | XtTranslations | NULL |
| DwtNmappedWhenManaged | Boolean | True |
| DwtNscreen | Screen * | The parent screen |
| DwtNdestroyCallback | DwtCallbackPtr | NULL |
Widget-Specific Attributes
You can set the following widget-specifc attributes in the override_arglist:
| Attribute Name | Data Type | Default |
| DwtNmarginWidth | Dimension | 2 pixels |
| DwtNmarginHeight | Dimension | Two pixels |
| DwtNcols | Dimension | 20 characters |
| DwtNrows | Dimension | 1 character |
| DwtNtopPosition | DwtTextPosition | Zero |
| DwtNwordWrap | Boolean | False |
| DwtNscrollVertical | Boolean | False |
| DwtNresizeHeight | Boolean | True |
| DwtNresizeWidth | Boolean | True |
| DwtNvalue | char * | "" |
| DwtNeditable | Boolean | True |
| DwtNmaxLength | int | 2**31-1 |
| DwtNfocusCallback | DwtCallbackPtr | NULL |
| DwtNhelpCallback | DwtCallbackPtr | NULL |
| DwtNlostFocusCallback | DwtCallbackPtr | NULL |
| DwtNvalueChangedCallback | DwtCallbackPtr | NULL |
| DwtNinsertionPointVisible | Boolean | True |
| DwtNautoShowInsertPoint | Boolean | True |
| DwtNinsertionPosition | int | Zero |
| DwtNforeground | Pixel | The current server’s default foreground |
| DwtNfont | DwtFontList | The current server’s DwtFontList |
| DwtNblinkRate | int | 500 milliseconds |
| DwtNscrollLeftSide | Boolean | False |
| DwtNhalfBorder | Boolean | True |
| DwtNpendingDelete | Boolean | True |
| DwtNdirectionRToL | unsigned char | DwtDirectionRightDown |
| DwtNtextPath | int | Left to right |
| DwtNeditingPath | int | Left to right |
| DwtNbidirectionalCursor | Boolean | False |
| DwtNnofontCallback | DwtCallbackPtr | NULL |
DwtNmarginWidth
Specifies the number of pixels between the left or right edge of the window and the text.
DwtNmarginHeight
Specifies the number of pixels between the top or bottom edge of the window and the text.
DwtNcolsSpecifies the width of the text window measured in character spaces.
DwtNrowsSpecifies the height of the text window measured in character heights or number of line spaces.
DwtNtopPosition
Specifies the position to display at the top of the window.
DwtNwordWrapSpecifies a boolean value that, when True, indicates that lines are broken at word breaks and text does not run off the right edge of the window.
DwtNscrollVertical
Specifies a boolean value that, when True, adds a scroll bar that allows the user to scroll vertically through the text.
DwtNresizeHeight
Specifies a boolean value that, when True, indicates that the compound-string text widget resizes its height to accommodate all the text contained in the widget. If this is set to True, the text will always be displayed starting from the first position in the source, even if instructed otherwise. This attribute is ignored if DwtNscrollVertical is True.
DwtNresizeWidth
Specifies a boolean value that, when True, indicates that the compound-string text widget resizes its width to accommodate all the text contained in the widget. This argument is ignored if DwtNwordWrap is True.
DwtNvalueSpecifies the text contents of the compound-string text widget. If you accept the default of NULL, the text path and editing path are set to DwtDirectionRightDown. Otherwise, the text path and editing path are set from the direction of the first segment of the value.
DwtNeditableSpecifies a boolean value that, when True, indicates that the user can edit the text in the compound-string text widget. If False, prohibits the user from editing the text.
DwtNmaxLengthSpecifies the maximum length of the text string, in characters, in the compound-string text widget.
DwtNfocusCallback
Specifies the callback function or functions called when the compound-string text widget accepted the input focus. For this callback, the reason is DwtCRFocus.
DwtNhelpCallback
Specifies the callback function or functions called when a help request is made. For this callback, the reason is DwtCRHelpRequested.
DwtNlostFocusCallback
Specifies the callback function or functions called when the compound-string text widget loses input focus. For this callback, the reason is DwtCRLostFocus.
DwtNvalueChangedCallback
Specifies the callback function or functions called when the value of the compound-string text widget changes. For this callback, the reason is DwtCRValueChanged.
DwtNinsertionPointVisible
Specifies a boolean value that, when True, indicates that the insertion point is marked by a blinking text cursor.
DwtNautoShowInsertPoint
Specifies a boolean value that, when True, ensures that the text visible in the compound-string text widget window contains the insertion point. This means that if the insertion point changes, the contents of the compound-string text widget window might scroll in order to bring the insertion point into the window.
DwtNinsertionPosition
Specifies the current location of the insertion point.
DwtNforegroundSpecifies the pixel for the foreground of the compound-string text widget.
DwtNfontSpecifies the font list to be used for the compound-string text widget.
DwtNblinkRateSpecifies the blink rate of the text cursor in milliseconds.
DwtNscrollLeftSide
Specifies a boolean value that, when True, indicates that the vertical scroll bar should be placed on the left side of the compound-string text window. This attribute is ignored if DwtNscrollVertical is False.
DwtNhalfBorderSpecifies a boolean value that, when True, indicates that a border is displayed only on the starting edge and bottom edge of the compound-string text widget.
DwtNpendingDelete
Specifies a boolean value that, when True, indicates that selected text containing the insertion point is deleted when new text is entered.
DwtNdirectionRToL
Specifies the direction in which the text is drawn and wraps. You can pass DwtDirectionLeftDown (text is drawn from left to right and wraps down); DwtDirectionRightUp (text is drawn from left to right and wraps up); DwtDirectionLeftDown (text is drawn from right to left and wraps down); or DwtDirectionLeftUp (text is drawn from right to left and wraps up). The DwtNdirectionRToL attribute only affects the direction toward which the window is resized.
DwtNtextPathSpecifies a read-only value that holds the main text path (direction) of the text in the compound-string text widget. It is set from the initial compound-string value of the widget. This attribute is used only if DwtNvalue is NULL.
DwtNeditingPath
Specifies a read-only value that holds the current editing text path (direction) in the compound-string text widget. It is set initially equal to DwtNtextPath. This attribute is used only if DwtNvalue is NULL.
DwtNbidirectionalCursor
Specifies a boolean value that, when True, indicates that the shape of the cursor at the insertion point will be dependent on the current editing direction.
DwtNnofontCallback
Specifies a callback function called when the compound-string text widget has failed to find a font needed for the display of a text tagged by a specific character set. For this callback, the reason is DwtCRNoFont.
Return Value
These functions return the ID of the created widget.
Callback Information
The following structure is returned to your callback:
typedef struct {
int reason;
XEvent *event;
char *charset;
unsigned int charset_len;
} DwtCSTextCallbackStruct;
The reason member is set to a constant that represents the reason why this callback was invoked. For this callback, the reason member can be set to:
| DwtCRFocus | The compound-string text widget has received the input focus. |
| DwtCRLostFocus | The compound-string text widget has lost the input focus. |
| DwtCRValueChanged | The user changed the value of the text in the compound-string text widget. |
| DwtCRHelpRequested | The user selected Help. |
| DwtCRNoFont | The widget font list contained no entry for the required character set. |
The event member is a pointer to the Xlib structure XEvent, which describes the event that generated this callback. This structure is a union of the individual structures declared for each event type. For information on XEvent and event processing, see the Guide to the Xlib Library: C Language Binding.
The charset member is set to the character set ID for which the widget has no matching font in its font list. The callback should modify the widget font list to include an entry for the required character set.
The charset_len member is set to the length of the charset string.
See Also
DwtCSTextReplace (3Dwt), DwtCSTextGetString (3Dwt), DwtCSTextSetString (3Dwt), DwtCSTextGetEditable (3Dwt), DwtCSTextSetEditable (3Dwt), DwtCSTextGetMaxLength (3Dwt), DwtCSTextSetMaxLength (3Dwt), DwtCSTextSetSelection (3Dwt), DwtCSTextGetSelection (3Dwt)
Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding
Subroutines