Using Variables Before They're Defined

Home Forums Problems and solutions in GDL Others Using Variables Before They're Defined

This topic contains 0 replies, has 1 voice, and was last updated by  Benjamin D’Amico 6 months ago.

  • Author
    Posts
  • #18497

    Benjamin D’Amico
    Participant

    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.

    Thanks Guys,

    -Ben

You must be logged in to reply to this topic.