GDL
About building parametric objects with GDL.

Changing Label position based on it's parameter.

Eshanta
Contributor

I am trying to create a label which changes it's position based on the co-ordinate values (global) defined in it's parameter.

 

For example, if the label is in a random position with initial parameters:

Global_X=1

Global_Y=2

 

and I change it to Global_X=3, Global Y=5, the label should move to global (3,5).

The initial position of the label does not matter i.e. when the user clicks on the element, the label can be placed anywhere but it has to move based on the global coordinates defined within it's parameters.

Can this be achieved ?
If it can, which command would help me achieve it ?

 

Thank you.

4 REPLIES 4
Lingwisyer
Guru

As far as I know, the only thing in GDL that can reference the Global Origin are textures through the COOR commands. If there is anything, you might be able to find it in the Survey Point object.

 

Correction: for 2D, you can use the globals Symbol_Pos_X and Symbol_Pos_Y. which will give you the objects relative position from the origin.

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Thank you very much for your reply.


I have already tried that and I get 0 no matter what.
I just tried it in a simple way as follows:

TEXT2 0, 0, SYMB_POS_X

 

Regardless of where I click, I always get zero.

 

Barry Kelly
Moderator

I'm not quite sure what you are trying to do, but as far as I know, the label position is stored in a GLOBAL variable.

This is from the GDL manual.

 

BarryKelly_0-1652433560834.png

 

It is a 3x2 array of the x & y coordinates of the leader arrow.

If you don't have the leader line on, I think it just uses the x & y coordinates of the first array value.

 

You should see those variables used to position the text in your label, so I am guessing you could manipulate those values.

i.e add values to them or simply use your own instead of those.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
DGSketcher
Legend

@Eshanta It does depend on what you are trying to do as to how you process the data points mentioned by @Barry Kelly. I have created labels that use parameters to position the text relative to the click / insertion point but the leader line on/off value will disrupt can disrupt what you are trying to achieve. Look at some of the GS label library objects to see if they help. The SYMB_POS_X & Y values and the data points will be important references in your GDL coding.  

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)