TmGetAttribute Function

Returns the value that was set for an attribute in a VDA Tool instance.

Usage

value = TmGetAttribute(tool_name, item, attr_name)

Parameters

tool_name—String containing the unique name of a VDA Tool.

item—String containing the name of a graphical element, variable, or other item in the VDA Tool.

attr_name—String containing an attribute name to get for the given item.

Returned Value

value—Value set for the attribute attr_name in the VDA Tool instance.

Keywords

Default—Used to set a default value for the attribute. If the attribute you want to get was not set, then the function will return this default value.

Discussion

TmGetAttribute is typically used in a method call procedure. For instance, when the drawing method TM_DISPLAY is activated for a VDA Tool, a procedure is executed that performs some kind of graphics operation. TmGetAttribute allows the procedures to obtain information from the Tools Manager about the values it needs to render the plot.

Example 1

Calls like the following can be used by a VDA Tool plotting routine to obtain the line color and linestyle that were registered with the Tools Manager using TmSetAttribute. In this case, the attributes are associated with a variable.

color = TmGetAttribute(tool_name, var, 'COLOR')
lstyle= TmGetAttribute(tool_name, var, 'LSTYLE')

Example 2

The title for the VDA Tool could be kept in an attribute, and the color of a variable could be set for future usage:

old_title = TmSetAttribute(tool_name, 'TM_TITLE', 'TEXT',$
title_text)
old_color = TmSetAttribute(tool_name, 'VARIABLE1', 'COLOR',$
'RED')

In the WzPlotTool plotting routine, the tool asks for some attribute settings:

; Gets the Xrange for image.
xminrange = TmGetAttribute(tool_name, 'RANGE', 'X_MIN')
; Gets the Yrange.
ymaxrange = TmGetAttribute(tool_name, 'RANGE', 'Y_MAX')
; Get the Z_Rotation.
z_rotat = TmGetAttribute(tool_name, 'ROTATION', 'Z')

Example 3

This example code demonstrates the effect of the Default keyword when a graphical element is not set and when a one is set.

; The attribute was not previously set.
INFO, TmGetAttribute(n0, 'TM', 'BAD_ATTR')
; PV-WAVE prints: <Expression>    STRING    = ''
; The attribute is set with the Default keyword.
INFO, TmGetAttribute(n0, 'TM', 'BAD_ATTR', default=1B)
; PV-WAVE prints: <Expression>    BYTE      =    1
; The attribute BACKGROUND is already set.
INFO, TmGetAttribute(n0, 'TM', 'BACKGROUND')
; PV-WAVE prints: <Expression>    INT       =       90
; The Default keyword has no effect if the attribute was set.
INFO, TmGetAttribute(n0, 'TM', 'BACKGROUND', default=1B)
; PV-WAVE prints: <Expression>    INT       =       90

See Also

TmEnumerateAttributes, TmSetAttribute