Move Objects Based On Value Of Other Object Follow

0
Avatar
Legacy Poster

Greetings,

 

I'm making a master label and pulling the database from my SQL data source.

I want to be able to move objects(lines, textbox) based on the value from a specific text box (text 6).

 

I was thinking if I could find how many lines of text are in "text 6", I would be able to calculate where the other objects should start.

 

Any ideas on how to find the number of lines of a field?

 

Thanks

 

 

3 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

You cannot check the number of lines of text there are in a text object, but you can check the height of the actual object that effectively gives you the same end result.

 

Objects(<object name or index>).Height = Value

 

There is an example of how to move objects by VB script in the "EU Energy Labels" samples directory in the "My Documents" folder.  The main meat of the logic can be found in the document level VB scripts.  I suggest you take a look at that, and also the below white paper: http://www.seagullscientific.com/media/101557/dynamically-changing-objects-at-print-time-using-vb-script.pdf

0
Avatar
Legacy Poster
Comment actions Permalink

Thanks,  I found the files.

For the object height.  How do I setup the object to change height depending on the length of text coming from the data source?

When I placed the field on the label, it appeared that if there was more text than the label size, the text would be cut off.

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

In script we can only check the height of the text object once data is set to it.  How much space a string of text takes up depends on the font type, size, width, proportional/monospace, style etc...  Have you considered using the auto-size feature for a text box which will grow/shrink the size of the text in a fixed area depending on the data set to the object?

 

To move an object in VB script you adjust its X or Y property.  For example:

 

Objects(<object name or index>).Y = Value 

 
Where Value determines the Y coordinate of the object reference point in the measurement units of the active template.

Please sign in to leave a comment.