Referencing Text Boxes in ObjectHi,
I am trying to change the orientation of a text box in object using the following script
ProbeMap[TextBox(40)]<
However I get the following error.
Cannot subscript Display Box{3825} in access or evaluation of 'Subscript' , ProbeMap[/*###*/Text Box( 40 )]
In the following script, error marked by /*###*/
ProbeMap[/*###*/Text Box( 40 )] << Rotate text( "Left" )
Tree structure of ProbeMap has TextBox(40), so I don't understand the reason for getting the error
Thanks
Re: Referencing Text Boxes in ObjectI consider this approach a 'best practice' that avoids (or at least minimizes) the problems with subscripts for display box objects in the display tree.
Re: Referencing Text Boxes in ObjectWhen referencing an offset from a point in any display box, the reference number will change depending upon the anchor point one is offsetting from. Therefore, I typically try to start my offsets from a Outline Box() close to the object I am going to be going after.
Re: Referencing Text Boxes in ObjectThanks everyone,
The code works, however one has to be careful about using the correct
object index.
See Example below
To change orientation of "DIE_COL" text (referenced as TextEditBox(22) in
the tree structure) I had to use the following code.
rep= ProbeMap << Top Parent;
rep[TextEditBox(11)]<
instead of
rep= ProbeMap << Top Parent;
rep[TextEditBox(22)]<
In summary, the object index required to manipulate the object is different
from the object index as seen in the tree structure.
[image: Inline image 1]
Re: Referencing Text Boxes in ObjectHere is the code with the missing semicolon added in
probemap = New Window( "test",
Outline Box( "this is a test",
Text Box( "the text box" ) )
);
rootParent = probemap << top parent;
rootParent[Text Box( 1 )] << Rotate text( "Left" );
Dave, thanks for the catch
Re: Referencing Text Boxes in ObjectGive or take a semicolon this is a better suggestion than mine, given the error message.
Re: Referencing Text Boxes in ObjectI am making the assumption that ProbeMap is a handle pointing to a display window. To make your code work, you need to find the root of the window. Here is some code that will illustrate how to do this
probemap = New Window( "test",
Outline Box( "this is a test",
Text Box( "the text box" ) )
);
rootParent = probemap << top parent
rootParent[Text Box( 1 )] << Rotate text( "Left" );
Re: Referencing Text Boxes in ObjectIs ProbeMap the object or the report window associated with the object? Perhaps you need something like:
rep = ProbeMap << Report;
rep[TextBox(40)]<<ROTATE text=""></ROTATE>