sandigcustomprinters.com Posted February 28, 2013 Share Posted February 28, 2013 I am trying to switch which frame contains copy, based on a copyfit. If copy fits in Frame A ("textblock"), then Frame B ("textblocklong") is suppressed. If copy does not fit in Frame A, then Frame A is suppressed and Frame B is used. Copy will always fit in Frame B. I cannot figure out to get this rule to put copy into Frame B("textblocklong") only when FrameA !Copyfit It does manage to suppress frame B when copyfits It does manage to suppress frame A when !copy does not fit It does not manage to put content into Frame B when !copy does not fit This novice needs some help with this rule. if (FusionPro.Composition.CurrentFlow.name == "textblock") { if (!Copyfit(new MagnifyAttributes("text", 100, 100, 0, 0))) FusionPro.Composition.CurrentFlow.content = ""; }else{ (FusionPro.Composition.CurrentFlow.name == "textblocklong") FusionPro.Composition.CurrentFlow.content = ""; } } Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted February 28, 2013 Share Posted February 28, 2013 In the OnCopyfit callback rule, you can't modify the contents of any text frame, or suppress a frame, other than the one being currently processed. What you can do, in OnRecordStart, is use the FusionProTextMeasure object to determine whether the text would fit into a particular frame, then set each frame's suppress property, or its text contents, as appropriate. This will work fine as long as the (smaller) frame doesn't wrap its text around any other frames. Quote Link to comment Share on other sites More sharing options...
sandigcustomprinters.com Posted March 4, 2013 Author Share Posted March 4, 2013 Can you help me with that OnRecordStart text Measure rule to suppress the frame? I very novice here and do not know how to write that. How do you write the text measure to determine if copy does not fit in the frame? var tm = new FusionProTextMeasure; tm.useTags = true; tm.CalculateTextExtent(Resource(BCText)); var tmWidth = tm.textWidth; if (tmWidth > "XX??") //if text exceeds frame { FindTextFrame("textblock").suppress = true; FindTextFrame("textblocklong").suppress = false; } else { FindTextFrame("textblock").suppress = false; FindTextFrame("textblocklong").suppress = true; } Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 9, 2013 Share Posted March 9, 2013 (edited) Something like this: var smallFrame = FindTextFrame("textblock"); var largeFrame = FindTextFrame("textblocklong"); var TM = new FusionProTextMeasure; TM.maxWidth = smallFrame.GetSettableTextWidth(); var err = TM.CalculateTextExtent(Resource(BCText).content); if (err && err != -1) throw "Error measuring text: " + TM.messages; var fitsInSmallFrame = TM.textHeight < smallFrame.GetSettableTextHeight(); smallFrame.suppress = !fitsInSmallFrame; largeFrame.suppress = fitsInSmallFrame; Edited March 9, 2013 by Dan Korn typo Quote Link to comment Share on other sites More sharing options...
sandigcustomprinters.com Posted March 11, 2013 Author Share Posted March 11, 2013 I just don't know this stuff well enough and I don't know what to do. I put in your wonderful rule, and it does not seem to understand the text measure. It always uses frame("textblock") and does not use frame("textblocklong") ever. file attached. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.