BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
pchavarkar

Community Trekker

Joined:

Dec 21, 2017

Referencing Text Boxes in Object

Hi,

 

I am trying to change the orientation of a text box in object using the following script

 

ProbeMap[TextBox(40)]<<Rotate text("Left");

 

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

 

 

7 REPLIES 7
David_Burnham

Super User

Joined:

Jul 13, 2011

Re: Referencing Text Boxes in Object

Is ProbeMap the object or the report window associated with the object?  Perhaps you need something like:

rep = ProbeMap << Report;
rep[TextBox(40)]<<Rotate text("Left")
-Dave
txnelson

Super User

Joined:

Jun 22, 2012

Re: Referencing Text Boxes in Object

I 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" );
Jim
David_Burnham

Super User

Joined:

Jul 13, 2011

Re: Referencing Text Boxes in Object

Give or take a semicolon this is a better suggestion than mine, given the error message.

-Dave
txnelson

Super User

Joined:

Jun 22, 2012

Re: Referencing Text Boxes in Object

Here 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

Jim
pchavarkar

Community Trekker

Joined:

Dec 21, 2017

Re: Referencing Text Boxes in Object

Thanks 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]

txnelson

Super User

Joined:

Jun 22, 2012

Re: Referencing Text Boxes in Object

When 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. 

Jim
markbailey

Staff

Joined:

Jun 23, 2011

Re: Referencing Text Boxes in Object

I consider this approach a 'best practice' that avoids (or at least minimizes) the problems with subscripts for display box objects in the display tree.

Learn it once, use it forever!