MeeshKB Posted January 16, 2013 Share Posted January 16, 2013 I am repurposing some code that Eric created for me on this thread. My intent here is to use the textMeasure code that Eric created to determine if both the employee name and designation fit on one line (just like in the previous instance), but now instead of breaking the line if the two do not fit, I want only the name to be copyfit so that both fit on the line together. I think I am on the right track with the code below, but I am getting a syntax error on line 23 (highlighted in red) of "copyfit not defined". And I suspect if that line is incorrect, the one above it is too. var name = Field("Name"); var designation = Field("Designation"); var result = ""; var frameWidth = 1.82; // width of your text frame in inches var tmName = new FusionProTextMeasure; tmName.pointSize = "11"; // point size of name tmName.font = "Helvetica 55 Bold"; // font for name tmName.useTags = true; var tmDesig = new FusionProTextMeasure; tmDesig.pointSize = "5"; // point size for designations tmDesig.font = "Helvetica 55 Roman"; // font for designations tmDesig.useTags = true; if (designation != "") { tmName.CalculateTextExtent(name + ", "); tmDesig.CalculateTextExtent(designation); if ((tmName.textWidth + tmDesig.textWidth) < frameWidth * 7200) { result = copyfit("", Field("Name"), "Helvetica 55 Bold", 11, 131, 8, false) + ', ' + Field("Designation"); } else result = copyfit("", Field("Name"), "Helvetica 55 Bold", 11, 131, 8, false); } else result = name; return result; I'm sure I'm making a silly error here. Can someone show me the error of my ways, please? Quote Link to comment Share on other sites More sharing options...
step Posted January 16, 2013 Share Posted January 16, 2013 The CopyFit function is only valid in the OnCopyFit call back rule. I think you want to use "CopyfitLine()" instead Quote Link to comment Share on other sites More sharing options...
MeeshKB Posted January 16, 2013 Author Share Posted January 16, 2013 Thanks, Ste. Changed it to copyfitline, but still the same error (copyfitline not defined). Quote Link to comment Share on other sites More sharing options...
step Posted January 16, 2013 Share Posted January 16, 2013 Do you have the casing correct? Capital "C", capital "L"? Quote Link to comment Share on other sites More sharing options...
MeeshKB Posted January 16, 2013 Author Share Posted January 16, 2013 Thank you, Ste. That was the issue. I knew it was a silly mistake! I made a couple of other tweaks as well and now it is working perfectly. Thank you so much for your help! Quote Link to comment Share on other sites More sharing options...
mgalligar Posted March 11, 2013 Share Posted March 11, 2013 Is there a way to color the text box with overflowing text Red? 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.