Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

DwtSText(3Dwt)

Name

DwtSText, DwtSTextCreate − Creates a simple text widget for the application to display a single or multiline text field.  The user can enter and edit text in this field. 

Syntax

Widget DwtSText(parent_widget, name, x, y, cols, rows, value)
     Widget parent_widget;
     char *name;
     Position x, y;
     Dimension cols, rows;
     char   *value;

Widget DwtSTextCreate (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 upper left corner 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 spaces.  888 This argument sets the DwtNcols attribute associated with DwtSTextCreate. 

rowsSpecifies the height of the text window measured in character heights or number of line spaces.  This argument sets the DwtNrows attribute associated with DwtSTextCreate. 

valueSpecifies the actual text to display.  This argument sets the DwtNvalue attribute associated with DwtSTextCreate. 

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 DwtSText and DwtSTextCreate functions create an instance of a simple text widget and return its associated widget ID.  When calling DwtSText, you set the text widget attributes presented in the formal parameter list.  For DwtSTextCreate, however, you specify a list of attribute name/value pairs that represent all the possible simple text widget attributes. 

The text widget enables the application to display a single or multiline field of text for input and edit manipulation by the user.  By default, the text window grows 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. 

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 with the specified DwtNmarginWidth
DwtNheight Dimension As large as necessary to display the DwtNcols with the specified DwtNmarginHeight
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 font list. 
DwtNblinkRate int 500 milliseconds
DwtNscrollLeftSide Boolean False
DwtNhalfBorder Boolean True
DwtNpendingDelete Boolean True
DwtNuserData Opaque * 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 simple text widget will attempt to resize 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 simple text widget will attempt to resize its width to accommodate all the text contained in the widget.  This argument is ignored if DwtNwordWrap is True. 

DwtNvalueSpecifies the actual text to display. 

DwtNeditableSpecifies a boolean value that, when True, indicates that the user can edit the text string in the simple text widget.  If False, prohibits the user from editing the text string. 

DwtNmaxLengthSpecifies the maximum length of the text string in the simple text widget. 

DwtNfocusCallback
Specifies the callback function or functions called when the simple 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.

DwtNlostFocusCallback
Specifies the callback function or functions called when the simple text widget loses focus. For this callback, the reason is DwtCRLostFocus. 

DwtNvalueChangedCallback
Specifies the callback function or functions called when the simple text widget value changed. 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 simple text widget window will contain the insertion point.  This means that if the insertion point changes, the contents of the simple text widget window may 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 simple text widget. 

DwtNfontSpecifies the font list to be used for the simple 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 simple 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 left and bottom edges of the simple 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. 

DwtNuserDataSpecifies any user private data to be associated with the widget.  The XUI Toolkit does not interpret this data. 

Return Values

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;
} DwtAnyCallbackStruct;

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 simple text widget has received the input focus. 
DwtCRLostFocus The simple text widget has lost the input focus. 
DwtCRValueChanged The user changed the value of the text string in the simple text widget. 
DwtCRHelpRequested The user selected Help. 

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. 

See Also

DwtSTextGetString (3Dwt), DwtSTextSetString (3Dwt), DwtSTextReplace (3Dwt), DwtSTextGetEditable (3Dwt), DwtSTextSetEditable (3Dwt), DwtSTextGetMaxLength (3Dwt), DwtSTextSetMaxLength (3Dwt), DwtSTextSetSelection (3Dwt), DwtSTextClearSelection (3Dwt), DwtSTextGetSelection (3Dwt)
Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding

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