[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

To an application, a string gadget consists of a standard Gadget structure
along with an entry buffer, an undo buffer and a number of extensions.

For a string gadget, set the GadgetType field in the Gadget structure to
GTYP_STRGADGET.  Set the SpecialInfo field to point to an instance of a
StringInfo structure, which must be initialized by the application.

The container for a string gadget is its select box.  The application
specifies the size of the container.  As the user types into the string
gadget, the characters appear in the gadget's container.

String gadgets may hold more characters than are displayable in the
container.  To use this feature, the application simply provides a buffer
that is larger than the number of characters that will fit in the
container.  This allows the user to enter and edit strings that are much
longer than the visible portion of the buffer.  Intuition maintains the
cursor position and scrolls the text in the container as needed.

The application may specify the justification of the string in the
container.  The default is GACT_STRINGLEFT, or left justification.  If the
flag GACT_STRINGCENTER is set, the text is center justified; if
GACT_STRINGRIGHT is set, the text is right justified.

When the gadget is activated, the select box contents are redrawn,
including the background area.  If GFLG_STRINGEXTEND is set for the gadget
or the gadget is using a proportional font by default, then the entire
select box will be cleared regardless of the font size or
StringInfo.MaxChars value.  For compatibility reasons, if the string
gadget is not extended then the following conditions apply (see the
section on "Extending String Gadgets" for more information).

  * If the font is monospace (not proportional), the width of the gadget
    will be rounded down to an even multiple of the font width.

  * If the string gadget is left justified (GACT_STRINGLEFT), a maximum
    of StringInfo.MaxChars times the font width pixels of space will be
    cleared.  Thus, if MaxChars is 3 (two characters plus the trailing
    NULL) and the font width is 8, then a maximum of 3 * 8 = 24 pixels
    will be cleared.  If the font defaults to a proportional font, then
    the width returned by FontExtent() will be used as the character
    width.

No facilities are provided to place imagery within the select box of a
string gadget.

 String Gadget Imagery and Highlighting