Jump to content

Linked Text Boxes in OnRecordStart


Recommended Posts

Hello,

 

Has anyone out there has found a way to adjust Linked Text Frames in the OnRecordStart rule or any other rule?

 

I have 3 linked Text Frames that have continuous text flowing through them. When I linked the text frames, the program applied the same name to all three. However, when I add the code to my OnRecordStart rule to adjust the y coordinate for the text frames with that name, it will only move the first box in the series.

 

Example: (moving frames 1 inch down on the y axis)

 

var ExFrame = FindTextFrame("Example Text");

 

if (Field("SampleField")== "Yes"){

ExFrame.y = (ExFrame.y) + (1 * 7200);

}

 

Thoughts?

 

P.S. 1 text box with multiple columns are not an option.

Link to comment
Share on other sites

I'm not sure I would call this a bug, but it is a design limitation. As you've figured out, when you name a text frame, what you're really doing is naming a text flow, which can contain multiple frames. And as the name of the FindTextFrame function suggests, it locates the first frame in the text flow with the given name. So you can't change the properties of any frame in a multi-frame text flow, other than the first frame, with JavaScript rules. (Although you can suppress the entire text flow.)

 

I'm frankly not even sure what a JavaScript function to return, say, the third frame in a named text flow would look like. Maybe FindTextFrame("Example Text", 3)? Or maybe a function like FindTextFlow which would return an array of frames? The point is that this feature was simply not designed to work in such a case; it was designed to work for the 95 percent of jobs which don't connect multiple text frames together into a flow, and the subset of those which simply need to modify single frame flows.

 

If you want to be able to modify all of the frames on a page, or even add new frames, including frames from multi-frame text flows, chart frames, text on a curve frames, and even modify the clipping frames for graphics separately from their actual graphic scaling frames, then you need to use the DIF Control API with FP Server. This is one of the selling points of extra functionality that you get with FP Server compared to Desktop.

 

However, you have other options as well. One thing I've seen people do in FP Desktop jobs, even before the ability to move text frames in JavaScript was added, is to use tables, and to insert empty rows and columns with specific depths and widths, in order to effectively move the table cell with the actual contents to an arbitrary position on the page. You could also accomplish the same thing with tagged markup, simply by adding blank lines (with a specific amount of leading) for the vertical offset, and using indents (in <p> tags) for the horizontal offset. Of course, it's not easy to flow from one table cell to another like this, or to know where to break up the text to add blank lines, so you would probably also need to do some text measurement to figure out where to break up the text into the different "frames."

 

If you just want to move all of the frames as a unit, say, to move them all one inch down on the Y axis, then you could put all of those frames onto a Template page, which you could then call out as an FPRepeatableComponent in a text rule, which you could then use in a single frame on the Body Page. Then you can use FindTextFrame to locate and move just that single Body Page frame which contains all of the frames from the Template (repeatable component) page. The Template page can contain a mix of text, graphics, and anything else. That's probably your best bet right there.

Link to comment
Share on other sites

Thank you, Dan!

 

Those are some great options to consider. And yes, I agree, it is a design limitation not so much a bug. I had a feeling that it wasn't something that is used often in FusionPro. It is actually a relief to know that I was not, in fact, missing something obvious. Again, thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...