Conditional Formatting Object Position based upon size of adjacent object Follow

0
Avatar
Mark Wright

 I have seen other requests on this topic here, but have not found a solution.

(see Setting X Position Of Object B Based On X + Width Of Object A) Sounds like a similar situation, but I did not see that it was resolved.

I have object 1 that is read from a database and could be variable in length (its a percentage).

Object 1 is in a different size font and only a single line.

Object 2 (Title) adjacent to the right is variable length and read from a database and of a different font and font size and may be on multiple lines depending upon length.

Both objects are pararaphs so that the width can be variable with the content.

I want object 2 to change positions according to the size of object 1 and also to change the width so that the combined width of objects 1 + 2 is consistent.

I have applied a VbScript On New Record that partially works; that is, it does change the position of object 2 based upon the width of object 1, BUT it applies it to the next label or record printed; not the current one being printed.

Example: if the first record object 1 value is "1%", there will be too much gap between the two objects. Then if the next record is "10%", the position of object 2 will be moved to the left where the end of "1%" would have been and they print over each other. If the following record is also a single digit, then it works great! But, that is not usually the case.

Similarly, if record object 1 value is "100%", it will re-position object 2 further to the right, but on the following record; not on the record with a value of "100%". 

It seems to be a timing of application when it reads the width value and applies.?

The script is as follows:

Format.Objects("Identity w/ %").Width = 1.25 - Format.Objects("Percent").Width   
Format.Objects("Identity w/ %").X = Format.Objects("Percent").X + Format.Objects("Percent").Width 

 

Thanks for any assistance;

Mark Wright

 

1 comments

0
Avatar
Pete Thane
Comment actions Permalink

Hi Mark,

I have seen something similar in the past with the order that the VB Script is processed that sometimes makes the timings (eg the OnNewRecord etc) look to be incorrect. 

Each time I have managed to get round this by processing the command later in the printing process such as OnIdenticalCopies or OnPostPrompt (normally this one). 

It maybe worth trying this to see if that clears the issue.

Pete 

Please sign in to leave a comment.