December 29, 2019 at 20:24 #18498
[THIS MAY HAVE A DUPLICATE POST – FORUMS ARE TRICKY]
I feel like I’m asking a novice question here. Still figuring out GDL best practices (any input on where to acquire this knowledge would be appreciated)!
I’ve run into this question a few times, with the following situation.
I want to place a text box in the 2D Script, which I’ve created as a macro object. But the positioning of the text2 command depends entirely on the length of the characters. Example:
CALL ‘Text Paragraph’ PARAMETERS txtFont=txtFont, txtSize=txtSize, txtPen=txtPen, txtBold=0, txtItal=0, txtUnder=0, txtAlign=”Center Aligned”, txtAnchor=”Middle-Center”, txtContent=txtContent1, txtWrap=0, txtLineSpace=1, txtAngle=txtAngle
n = REQUEST (“TEXTBLOCK_INFO”, ‘txtBlock’, txtWid, txtHit)
txtX1 = txtWid/1000*GLOB_SCALE
txtY1 = txtHit/1000*GLOB_SCALE
So with n=REQUEST, I’m able to learn the width and height of the text box. Now say that the object that I’m creating has a limited amount of space in which to contain said text box, and my positioning of the text box within the overall object depends entirely on how wide the text box will be. How would I be able to call ‘Text Paragraph’, define the parameter ‘txtX1’, and then go back in time (so to speak), to adjust my ADD2 command so that it reflects the new-found width?
I feel like there has to be a generally accepted way to call up an object and learn it’s parameters before actually placing it in the 2D script. But again, I’m still learning.
January 2, 2020 at 10:30 #18499
TEXTBLOCK width can be 0 to automatically calculate the width, or you can give a value, and that will be used.
You can later place that texblock with RICHTEXT2, so there is the place for transformations if the width is automatic.
Also you can return values from macros using RETURNED_PARAMETERS, maybe the width calculation is better to be done in the macro.
We have a tutorial about TEXTBLOCK:
Library Platform, Software Engineer
You must be logged in to reply to this topic.