Retrieves the context dependent autotext’s value.
GSErrCode ACAPI_Goodies ( APIAny_InterpretAutoTextID, const GS::UniString* autotext, const API_Guid* guid, GS::UniString* value );
Parameters
- autotext
- [in] A pointer to a GS::UniString containing the key for the context dependent autotexts key, without the ‘<‘ and ‘>’ signs. For example the “<The autotext key>” should look like “The autotext key”.
- guid
- [in] Pointer to a API_Guid element for context dependency resolution. This can be the guid of any object which can contain an autotext. For example a label’s guid is sufficient to resolve the autotext’s value present on that label.
- value
- [out] A GS::UniString pointer that is either empty or contains the autotext’s value.
Return Values
NoError
- The function has completed with success.
APIERR_BADPARS
- Either the
autotext
or thevalue
wasnullptr
. APIERR_GENERAL
- The passed
autotext
could not be resolved or it is has invalid formatting.
For other common API errors see the API Errors document.
Remarks
Use this function to find the value of context dependent autotext keys. In this context, context dependency means that the value of a given autotext is determined by the object that it is bound to. For example a label with an autotext <Element Id> will show the object’s Element Id that the label is bound to. These autotexts have a format similar to: <PROPERTY-69A58F6F-DD3B-478D-B5EF-09A16BD0C548>
Remember to dispose of the ‘<‘ and ‘>’ signs before passing the function an autotext key. So the previous example should look similar to PROPERTY-69A58F6F-DD3B-478D-B5EF-09A16BD0C548.
Example
API_Guid guid; if (!ClickAnElem ("Click on a slab to acquire all of its available properties.", API_SlabID, nullptr, nullptr, &guid)) { WriteReport_Alert ("No slab was clicked!"); return; } else { WriteReport ("Slab clicked!"); GS::HashTable<GS::UniString, GS::UniString> properties; ACAPI_Goodies (APIAny_GetPropertyAutoTextKeyTableID, (API_Guid *) &APINULLGuid, &properties); GSErrCode err = ACAPI_Goodies (APIAny_GetPropertyAutoTextKeyTableID, &guid, &properties); if (err == NoError) { properties.EnumeratePairs ( [&err, &guid] (const GS::UniString& propertyName, GS::UniString& propertyKey) -> void { GS::UniString value; err = ACAPI_Goodies (APIAny_InterpretAutoTextID, &propertyKey, &guid, &value); if (err == NoError) { WriteReport ("%T is: %T", propertyName.ToPrintf (), value.ToPrintf ()); } else { WriteReport ("Autotext for %T could not be resolved.", propertyName.ToPrintf ()); } }); } else { WriteReport ("Error while retrieving the property autotext key table."); } }
Requirements
- Version: API 21 or later
- Header: APIdefs_Goodies.h
See Also
APIAny_GetPropertyAutoTextKeyTableID
APIAny_GetAutoTextKeysID
APIAny_GetAutoTextsID
APIAny_SetAnAutoTextID
ACAPI_Goodies
API Functions