Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

GDL
About building parametric objects with GDL.
SOLVED!

how to use for loop for the values of ui_infield{3}

Ady84a
Booster
Dear all,
 
I have an array ( _stDrawerTypes[ ] ). The values are inserted dynamically by reading a text file.
is there a way in (ui_infield{3}) in order to use this array (_stDrawerTypes[ ]) for the values without manually typing _stDrawerTypes[1], _stDrawerTypes[2], etc
for example using for loop or other idea
 
! UI Script
ui_infield{3} "iSymbolType", 10, _yPosition, _infieldWidth, _infieldHeight,
_method, "5", 4, 2,
_infieldWidth, _infieldHeight, _imageWidth, _imageHeight,
1, _stDrawerTypes[1], "value 1",
2, _stDrawerTypes[2], "value 2",
3, _stDrawerTypes[3], "value 3",
4, _stDrawerTypes[4], "value 4",
5, .....................
6, ..............
 
Screenshot01.JPG
 
thanks in advance!
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Jochen Suehlo
Moderator

I use the following routine mostly always:

! MASTER-SCRIPT

DIM _typ_best_text[], _typ_best_pic[], _typ_best_value[]
i = 1
_typ_best_text[i] = "Schnitt 1 b" : _typ_best_pic[i] = "" : _typ_best_value[i] = i : i = i + 1
_typ_best_text[i] = "Schnitt 1 c" : _typ_best_pic[i] = "" : _typ_best_value[i] = i : i = i + 1
_typ_best_text[i] = "Schnitt 2 e" : _typ_best_pic[i] = "" : _typ_best_value[i] = i : i = i + 1
_typ_best_text[i] = "Schnitt 11 f" : _typ_best_pic[i] = "" : _typ_best_value[i] = i : i = i + 1

! ---------------------------------------------------------------------- !



! PARAMETER-SCRIPT

VALUES{2} "int_typ_best", _typ_best_value, _typ_best_text



! INTERFACE-SCRIPT

UI_OUTFIELD "Bestückungstyp", dx, dy + dyO, outL, outH, 1
UI_INFIELD{3} "int_typ_best", dx2, dy, inL, inH,
8, "",
0, 0, 0, 0, 0, 0,
_typ_best_pic, _typ_best_text, _typ_best_value
dy = dy + led

! ......................... !
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de

View solution in original post

4 REPLIES 4
Solution
Jochen Suehlo
Moderator

I use the following routine mostly always:

! MASTER-SCRIPT

DIM _typ_best_text[], _typ_best_pic[], _typ_best_value[]
i = 1
_typ_best_text[i] = "Schnitt 1 b" : _typ_best_pic[i] = "" : _typ_best_value[i] = i : i = i + 1
_typ_best_text[i] = "Schnitt 1 c" : _typ_best_pic[i] = "" : _typ_best_value[i] = i : i = i + 1
_typ_best_text[i] = "Schnitt 2 e" : _typ_best_pic[i] = "" : _typ_best_value[i] = i : i = i + 1
_typ_best_text[i] = "Schnitt 11 f" : _typ_best_pic[i] = "" : _typ_best_value[i] = i : i = i + 1

! ---------------------------------------------------------------------- !



! PARAMETER-SCRIPT

VALUES{2} "int_typ_best", _typ_best_value, _typ_best_text



! INTERFACE-SCRIPT

UI_OUTFIELD "Bestückungstyp", dx, dy + dyO, outL, outH, 1
UI_INFIELD{3} "int_typ_best", dx2, dy, inL, inH,
8, "",
0, 0, 0, 0, 0, 0,
_typ_best_pic, _typ_best_text, _typ_best_value
dy = dy + led

! ......................... !
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Lingwisyer
Guru

Looks like something you would use PUT GET for.

For i = 1 to drawers
PUT i, _stDrawerType[i], value[i]
next i

Do note I have no experience with infield{3} or using the put command with arrays.

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660

perfect, thank you!

This is exactly what I was looking for. It worked like a charm.

 

 

thank you for your suggestion.

This is a good idea but I could not manage it with infield{3}  and the arrays.