Reposition-able text

This topic contains 4 replies, has 3 voices, and was last updated by  Dominika Bobály 11 months, 2 weeks ago.

  • Author
    Posts
  • #2917

    Patrick May
    Participant

    This is a stupidly rudimentary problem, that I should be able to figure out, but am running into too many road blocks to decipher the GDL help center’s guides.
    How do I associate a text box with a hot spot, or other means of graphically repositioning the text?
    I want to be able to just click on the text’s mid-point and drag to position.

  • #2918

    Barry Kelly
    Participant

    Without actually writing the code all you need to do is create the script for the moveable (stretchy) hotspot – you can ad a rotating hotspot too if you want.
    Then use an ADD2 command (and ROT2 command if desired) using the hotspot parameters.
    Then TEXT2 0,0,”text” and the text will move with the hotspots.

    If you are not worried about moving the text differently for different scales and/or rotating then you can skip the ADD2 and ROT2 and use the hotspot parameters directly in the TEXT2 command.

    If you need an actual coded example let me know.

    Barry.

    Versions 6.5 to 20
    Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
    Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit

  • #2920

    Patrick May
    Participant

    I have:

    unID = 001
    HOTSPOT2 textOffset_x,textOffset_y,001
    TEXT2 textOffset_x,textOffset_y,txtParam

    what am I missing? An example would be great…

    • #2927

      Dominika Bobály
      Keymaster

      Barry is right, you need the “editable” kind of hotspots for parametric positioning. See a tutorial here.

      Dominika Bobály
      Library Developer, Library Team
      GRAPHISOFT SE

  • #2922

    Barry Kelly
    Participant

    You are using just a single hotspot.
    You need a moveable or stretchy hotspot.
    In fact you need 2 – one to move horizontally and the other vertically.

    Something like this…

    unID = 1000
    
    !!!!!!!!!!!! x-axis stretchable
    
    HOTSPOT2 0, textOffset_y, unID, textOffset_x, 1+256
    unID=unID+1
    HOTSPOT2 -0.001, textOffset_y, unID, textOffset_x, 3+128
    unID=unID+1
    HOTSPOT2 textOffset_x, textOffset_y, unID, textOffset_x, 2
    unID=unID+1
    
    !!!!!!!!!!!! y-axis stretchable
    
    HOTSPOT2 textOffset_x, 0, unID, textOffset_y, 1+256
    unID=unID+1
    HOTSPOT2 textOffset_x, -0.001, unID, textOffset_y, 3+128
    unID=unID+1
    HOTSPOT2 textOffset_x, textOffset_y, unID, textOffset_y, 2
    unID=unID+1
    
    !!!!!!!!!!the text
    
    TEXT2 textOffset_x,textOffset_y,txtParam

    The initial UNID can be set to whatever value you want.
    The trick is hotspots should always have different values so if you repeat the hotspots again reset with a new UNID

    Barry.

    Versions 6.5 to 20
    Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
    Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit

You must be logged in to reply to this topic.