cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
GDL
About building parametric objects with GDL.
SOLVED!

Multiple Texts from Parameter Array

GDL Enthusiast
Advocate

Hi,

 

In a separate post, Jochen and AllanP showed how to use switches for arrays: 

https://community.graphisoft.com/t5/GDL/Multiple-on-off-switches-via-array-for-switching-within-UI/m...

 

I wanted to do the same with text but for some weird reason it keeps returning an error when the type is changed to Parameter type is changed ABC. Could anyone advise what I am doing wrong in my code, so confusing?

 

Parameter Array Name: UI_Text_Array

 

!!Masterscript, 2D, 3D, Parameters Script - all empty

 

!!UI Script:

FOR i = 1 TO 6
ui_outfield "Text Parameter Array:", 0, 0 + (i - 1) * 20, 100, 14
ui_infield UI_Text_Array[i], 120, 0 + (i - 1) * 20, 220, 14
NEXT i

 

It returns the error " ' ' isn't a valid parameter name" from within the interface script.

 

From that error, I assume I haven't initialized the array. So I click on the button (1) in the Parameters beside the field UI_Text_Array to ensure it is set to array. Then in the little square box (2) I add 6 fields leaving them blank (3 and 4). Is this how one initializes an array, sorry for the super simple question.

 

I have attached the GSM file for ease of reference.

 

Many thanks and best regards, from Matt


Image 1.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
runxel
Hero

Your parameter being an array is the clue, but not in the way you might have thought:

You'd need to use version 2 of the infield: UI_INFIELD{2} UI_Text_Array[i], 120, 0 + (i - 1) * 20, 220, 14

Because UI_INFIELD only works with the parameter name being an actual string. Here however, because we have an array, we cannot do that; we need to pass a reference. So put in the param name without quotes.

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

View solution in original post

2 REPLIES 2
Solution
runxel
Hero

Your parameter being an array is the clue, but not in the way you might have thought:

You'd need to use version 2 of the infield: UI_INFIELD{2} UI_Text_Array[i], 120, 0 + (i - 1) * 20, 220, 14

Because UI_INFIELD only works with the parameter name being an actual string. Here however, because we have an array, we cannot do that; we need to pass a reference. So put in the param name without quotes.

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

Hooray, thank you so much Runxel! It's amazing how many hours I sink into trying to get code working and how quickly you solve it, so so apreciated!!! Wishing you all the best, from Matt