The TAG_NAMES function returns a string array containing the names of the tags in a structure expression. It can also be used to determine the expression’s structure name (if the structure has a name).
TAG_NAMES and Object Class Definition Structures
Although an instance of an object class has an associated structure definition, it is not generally possible to inspect the tags defined by the class structure directly using TAG_NAMES. The exception to this rule is that inside an object method you can use TAG_NAMES to inspect the class structure of an object reference.
Examples
Print the names of the tags in the system variable !P by entering:
PRINT, TAG_NAMES(!P)
IDL prints:
BACKGROUND CHARSIZE CHARTHICK CLIP COLOR FONT LINESTYLE MULTI
NOCLIP NOERASE NSUM POSITION PSYM REGION SUBTITLE SYMSIZE T
T3D THICK TITLE TICKLEN CHANNEL
Print the name of the structure in the system variable !P:
PRINT, TAG_NAMES(!P, /STRUCTURE_NAME)
IDL prints:
!PLT
Syntax
Result = TAG_NAMES( Expression [, /STRUCTURE_NAME] )
Return Value
Returns structure tag names or the expression’s structure name.
Arguments
Expression
The structure expression for which the tag names are returned. This argument must be of structure type. TAG_NAMES does not search for tags recursively, so if Expression is a structure containing nested structures, only the names of tags in the outermost structure are returned.
Keywords
STRUCTURE_NAME
Set this keyword to return a scalar string that contains the name of the structure instead of the names of the tags in the structure. If the structure is “anonymous”, an empty string is returned.
Version History
See Also
CREATE_STRUCT, N_TAGS