[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