string.gadget Reference¶
Comprehensive function reference for string.gadget, synthesised from the AmigaOS NDK 3.2 Release 4 (Autodocs/string).
This page documents 2 functions of string.gadget. Each function entry follows the canonical autodoc format. struct Name, union Name, enum Name are clickable links to the type definition in the types reference.
Function index¶
string_gc()¶
**string_gc -- create string BOOPSI objects
SUPERCLASS
gadgetclass
REQUIRES
bevel.image
DESCRIPTION
The string gadget class is used to create single line
editable strings. This class also supports window relativity.
This class is a subclass of rom strgclass which automatically
creates a field bevel and supports GM_DOMAIN for layout groups.
METHODS
OM_NEW -- Passed to superclass, strgclass allocated, then OM_SET.
OM_SET -- Passed to superclass, and strgclass is set.
OM_UPDATE -- Passed to superclass, and strgclass is set then
rendered.
OM_DISPOSE -- Disposes strgclass object, then passed to superclass.
GM_RENDER -- Passed to superclass, then strgclass object
GM_HITTEST -- Overrides supperclass, returns GMR_HITTEST.
GM_GOACTIVE -- Passed to superclass, strgclass, string activated
GM_HANDLEINPUT -- Routes input to strgclass object.
GM_GOINACTIVE -- Passed to superclass, strgclass, string deactivated.
GM_DOMAIN -- Returns GDOMAIN_MINIMUM, GDOMAIN_NOMINAL and
GDOMAIN_MAXIMUM dimensions.
ATTRIBUTES
GA_Disabled (BOOL)
Determines whether the string is disabled or not.
Changing disable state will invoke GM_RENDER. A disabled
string is dusted in a ghosting pattern that is rendered
in SHADOWPEN.
Defaults to FALSE.
Applicability is (OM_NEW, OM_SET, OM_UPDATE)
GA_TextAttr (struct TextAttr *)
Text attribute for the font to use for the string.
Defaults to RPort->Font, which is often the screen or
window font.
Applicability is (OM_NEW)
GA_ReadOnly (BOOL)
Read-only gadgets ignore activation attempts.
Defaults to FALSE.
Applicability is (OM_NEW, OM_SET, OM_UPDATE)
GA_BackFill (struct Hook *)
A layer backfill hook to provide a more complex
background pattern. See InstallLayerHook() for
more details about the backfill hook.
Defaults to NULL.
Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)
STRINGA_LongVal (LONG)
This attribute tells string.gadget that this
gadget is an integer string gadget and the new value
of the integer is this attribute's value.
It is recommended to use the much more powerful
integer.gadget instead.
Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET, OM_NOTIFY)
STRINGA_TextVal (STRPTR)
This attribute tells the string.gadget that this
gadget is a plain string gadget. The attribute
points to a string which the object copies into the
gadget's current string value buffer.
Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET, OM_NOTIFY)
When a string.gadget's value changes (usually because
the user manipulated the gadget), an OM_NOTIFY
message will be sent. The message will contain two
attribute/value pairs, GA_ID and either STRINGA_LongVal
or STRINGA_TextVal depending on what kind of gadget
it is.
STRINGA_Buffer (STRPTR)
Specifies the buffer used for displaying the
value to be edited.
Defaults to an internal buffer of size
SG_DEFAULTMAXCHARS (currently 128 bytes).
Applicability is (OM_NEW)
STRINGA_WorkBuffer (STRPTR)
Specifies the buffer to be used while the user
edits the text in the gadget.
Defaults to an internal buffer of size
SG_DEFAULTMAXCHARS (currently 128 bytes).
Applicability is (OM_NEW)
STRINGA_UndoBuffer (STRPTR)
Specifies the buffer to be used for undo while
the user edits the text in the gadget.
Defaults to an internal buffer of size
SG_DEFAULTMAXCHARS (currently 128 bytes).
Applicability is (OM_NEW)
STRINGA_MaxChars (WORD)
The maximum number of characters the user can edit.
This includes the NUL terminator. Eg. to allow 10
characters, you should pass a STRINGA_MaxChars of 11.
If you increase this beyond SG_DEFAULTMAXCHARS, you
will also need to supply large enough display/work/undo
buffers using the STRINGA_Buffer, STRINGA_WorkBuffer
and STRINGA_UndoBuffer tags.
Defaults to SG_DEFAULTMAXCHARS (currently 128 bytes).
Applicability is (OM_NEW)
STRINGA_BufferPos (WORD)
The current position of the cursor within the buffer
from zero to the current length of the buffer string.
Defaults to the end of the buffer string.
Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)
STRINGA_DispPos (WORD)
The current position of the cursor within the
displayed buffer area which can range from zero to
the current length of the buffer string.
Defaults to the end of the buffer string.
Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)
STRINGA_AltKeyMap (struct KeyMap *)
Alternative key map to use for this string gadget
which will be passed to MapRawKey().
Defaults to NULL.
Applicability is (OM_NEW, OM_SET)
STRINGA_Font (struct TextFont *)
The font to use for rendering text.
Defaults to the RastPort font of the parent Window.
Applicability is (OM_NEW, OM_SET, OM_UPDATE)
STRINGA_Pens (ULONG)
Pen numbers packed as two UWORD values into a
single ULONG value for rendering inactive gadget
text. The upper UWORD is the background color and
the lower UWORD is the text color.
Defaults to TEXTPEN (text) and FOREGROUNDPEN.
Applicability is (OM_NEW, OM_SET)
STRINGA_ActivePens (ULONG)
Pen numbers packed as two UWORD values into a
single ULONG value for rendering active gadget
text. The upper UWORD is the background color and
the lower UWORD is the text color.
Defaults to TEXTPEN (text) and BACKGROUNDPEN.
Applicability is (OM_NEW, OM_SET)
STRINGA_HookType (UWORD) (V41)
Use one of the build in string editing hooks:
SHK_CUSTOM (default)
SHK_PASSWORD
SHK_IPADDRESS
SHK_FLOAT
SHK_HEXIDECIMAL
SHK_TELEPHONE
SHK_POSTALCODE (not implemented)
SHK_AMOUNT (not implemented)
SHK_UPPERCASE
SHK_HOTKEY (V45)
WARNING: Do NOT use STRINGA_HookType unless string.gadget
V45 is installed. Some of the hooks were broken before!
Applicability is (OM_NEW)
STRINGA_EditHook (struct Hook *)
Custom string gadget edit hook. The hook is called
with the following paramters:
result = Edit( hook, sgw, msg )
LONG Edit(struct Hook* hook,
struct SGWork* sgw,
ULONG* msg);
See <intuition/sghooks.h> for more details on how
to implement string gadget edit hooks.
Defaults to no edit hook.
Applicability is (OM_NEW)
STRINGA_EditModes (ULONG)
Value taken from flags defined in
<intuition/sghooks.h> for initial editing modes.
Applicability is (OM_NEW, OM_SET)
STRINGA_ReplaceMode (BOOL)
This flag corresponds to the SGM_REPLACE flag
defined in <intuition/sghooks.h>.
Applicability is (OM_NEW, OM_SET)
STRINGA_FixedFieldMode (BOOL)
This flag corresponds to the SGM_FIXEDFIELD flag
defined in <intuition/sghooks.h>.
Applicability is (OM_NEW, OM_SET)
STRINGA_NoFilterMode (BOOL)
This flag corresponds to the SGM_NOFILTER flag
defined in <intuition/sghooks.h>.
Applicability is (OM_NEW, OM_SET)
STRINGA_ExitHelp (BOOL)
This flag corresponds to the SGM_EXITHELP flag
defined in <intuition/sghooks.h>.
Applicability is (OM_NEW, OM_SET)
STRINGA_Justification (ULONG)
Takes the values GACT_STRINGCENTER, GACT_STRINGRIGHT
and GACT_STRINGLEFT.
Defaults to GACT_STRINGLEFT.
Applicability is (OM_NEW, OM_SET)
STRINGA_AllowMarking (BOOL) (V45)
Enable or disable marking.
Defaults to TRUE.
Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)
STRINGA_Mark (ULONG) (V45)
Mark the given block. The upper 16 bits of the longword
contain the start position and the lower 16 bits contain
the end position. If one or both values are -1 ($FFFF),
the current block will be unmarked.
Applicability is (OM_SET, OM_NEW, OM_UPDATE, OM_GET)
STRINGA_GetBlockPos (ULONG)
Deprecated tag. Use STRINGA_Mark instead.
Applicability is (OM_GET)
STRINGA_MinVisible (WORD) (V41)
Set the minimum number of characters that should be
visible for a 'GDOMAIN_MIMIMUM' domain size. Nominal
domain sizes to twice this minimum. This is a handy
addition (also present in V40.35) to ensure a minimum
number of characters will be visible in a string gadget.
Defaults to 4.
Applicability is (OM_NEW, OM_SET, OM_UPDATE, OM_GET)**
Notes
The string class passes all tags to its strgclass child,
please see strgclass tags & autodocs, and look in
<intuition/gadgetclass.h> for the STRINGA_ tags.
WARNING: Upto v45 string.gadget is ROM strgclass wrapper.
Depending on string.gadget version, passing GA_Text can crash
strgclass; please use STRING_TextVal as it is intended. STRINGA_Font
and STRINGA_LongVal are not directly supported; for numeric
strings use our more powerful integer.gadget class. To specify
the font for the gadget, use GA_TextAttr which is consistent
with all other ReAction gadget attributes.
STRING_GetClass()¶
STRING_GetClass -- Gets the pointer to the string class.
Synopsis
string_class = STRING_GetClass();
D0
Class * STRING_GetClass(VOID);
Function
Obtains the pointer to the string gadget class for use with
NewObject(). This function always returns a valid pointer so
you do not need to check it. The reason is that if the library
opens fine, then the pointer returned is already setup. (Of course
this implies that if opening the library fails, you shouldn't be
calling this.)
Note that this function does not create the class, that is done
when the class library is opened.
Inputs
Nothing.
RESULT
string_class - Pointer to the string gadget class.