2023-11-13 02:24 AM - last edited on 2024-09-26 01:46 PM by Doreena Deng
Hi,
I wonder, is it possible to dynamically move the x,y, position of text in the interface tab? My goal is to dynamically offset text, within the interface panel, depending on a parameter of the script.
My example would be to create a variable in the Parameters Tab called x_offset = 10mm
In the Interface tab I would add the code:
ui_outfield "Note", x_offset, 0, 120, 14
However it doesn't seem to work and defaults the position value to 0. Any help would be most welcome! Best to all.
Solved! Go to Solution.
2023-11-13 03:04 AM - edited 2023-11-13 03:05 AM
Sure you can.
Make your parameter a 'integer' because the interface is pixels, not distance.
Then the script.
UI_OUTFIELD "Infield position", infield_pos,30,80,15
UI_INFIELD "infield_pos", infield_pos+85, 30,50,15
And the result.
Have fun chasing it around the interface.
Barry.
2023-11-13 03:04 AM - edited 2023-11-13 03:05 AM
Sure you can.
Make your parameter a 'integer' because the interface is pixels, not distance.
Then the script.
UI_OUTFIELD "Infield position", infield_pos,30,80,15
UI_INFIELD "infield_pos", infield_pos+85, 30,50,15
And the result.
Have fun chasing it around the interface.
Barry.
2023-11-13 10:50 AM
That works beautifully with an integer, I never would have discovered that myself, thank you Barry you are a genius, quite exciting!
From the above, is possible to use the value from a dimension variable (x_offset) to drive the integer variable (infield_pos)?
My thinking would be in the Master Script to add something like:
infield_pos = INT(x_offset)
Parameter x_offset = infield_pos
But maybe it is not possible to use a value in mm to set an integer value in pixels, it would be great if it was though. Best to all.
2023-11-13 10:53 AM
Found solution to the above of converting the dimension from mm. It works, thank you again Barry, so so helpful!
2023-11-13 12:55 PM - edited 2023-11-16 10:15 AM
@GDL Enthusiast wrote:
Found solution to the above of converting the dimension from mm. It works, thank you again Barry, so so helpful!
Yes that would work too.
All lengths in GDL are in meters, regardless of your working units.
So multiply by 1000 to get mm.
But just be aware the default user interface is only around 444 x 296 a minimum of 480 wide x 266 high pixels (it is customisable and can be a little bit bigger), but it will be very easy to exceed this limit with mm.
Barry.
2023-11-16 09:43 AM
The settings dialog minimum width has changed to 480 pixels in AC24, and the minimum height is 266 pixels.
2023-11-16 07:45 PM - edited 2023-11-16 07:46 PM
@Peter Baksa wrote:The settings dialog minimum width has changed to 480 pixels in AC24, and the minimum height is 266 pixels.
Aaaah thanks for this info, I knew the old values were wrong somehow but never knew for sure. When using the old values with listfields, they were cut at the bottom so I ended finding the 266px by testing myself. Same for 480, one day I went beyond 444 and noticed it was fine so I went further until the display was cut.
However, this info needs to be updated though, here in the online guide : https://gdl.graphisoft.com/reference-guide/the-user-interface-script
Currently, the size of the available area is fixed at 444 x 296 pixels, and the size_x and size_y parameters are not used.
And also in the GDL reference pdfs. In my 26 installation, it is the same on page 263
Currently, the size of the available area is fixed at 444 x 296 pixels, and the size_x and size_y parameters are not used.
2023-11-17 02:24 AM
@MF BIM ,
That is just the default minimum size.
You can set a custom dialogue much larger if you want to.
Here I have just increased one of my window interfaces.
UI_DIALOG `CUSTOM SETTINGS`, 750,550
So there is much more space to be had if you need it.
I probably wouldn't go too big though.
Barry.
2023-11-17 08:13 AM
Yes, I know this, I was just rebounding on the fact that if you do not input those optional inputs for UI_DIALOG, the default dimensions are wrong according to the GDL guides.