We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2024-06-25 09:19 AM - last edited on 2024-06-29 12:24 PM by Laszlo Nagy
I would like to use arrays for certain fields; is there a way to have the UI allow a drop down from an array field rather than what Im getting atm
Manual states
I need a drop down for each array item and dont want this behaviour which jump s the user to an standard array input and not highlighting the relative index
I would like each field to display the field value
Mark Wesse
AC26 | Win10 | Since v6.5r
Architerion - Architectural Systems Developer
Aurasphere - Acoustics
Building Biology - Human Compatible Architecture
"--- Every time...do it better ---"
2024-06-26 03:45 AM
What happens if you use ui_listfield?
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2024-06-26 07:21 AM - edited 2024-06-26 07:25 AM
How are you structuring the parameter's array currently? Do you have 24 separate parameters each with an array, or a single parameter with 24 items in the array.
If its a single parameter with 24 items to represent each component, you can just include the array index after the parameter name in UI_INFIELD .
ui_infield param[1] x, y, width, height
However, to get the dropdown list of available items you need to use a index-string pair value set.
So instead of setting your parameter you are storing the information in to a String, set it to an Integer.
And then use the following Value code in your Parameter script:
dim aComponentsIndex[]
dim aComponentsDescription[]
aComponentsIndex[1] = 1
aComponentsDescription[1] = "1 - PIERS"
aComponentsIndex[2] = 2
aComponentsDescription[2] = "2 - FOOTINGS"
VALUES{2} "param", aComponentsIndex, aComponentsDescription
And an associated example in the Interface Script:
UI_INFIELD{3} param[1], 10,10,300,20
UI_INFIELD{3} param[2], 10,10,300,20
UI_INFIELD{3} param[3], 10,10,300,20
UI_INFIELD{3} param[4], 10,10,300,20
....
However that doesn't seem to be showing the the description in the UI field for some reason, so I had to go down the route of using the UI_INFIELD dropdown method. Full script:
!! MASTER SCRIPT
dim aComponentsIndex[] ! Create the array to story the indexes of your dropdown list
dim aComponentsDescription[] ! Create another array for Description of each item in your dropdown list
dim aComponentsImages[] ! And a last array to link to an image file for each item - this isnt required but the UI_INFIELD was requiring something
aComponentsIndex[1] = 1
aComponentsDescription[1] = "1 - PIERS"
aComponentsImages[1] = ""
aComponentsIndex[2] = 2
aComponentsDescription[2] = "2 - FOOTINGS"
aComponentsImages[2] = ""
!! create the additional items in your dropdown in the above format
!! PARAMETER SCRIPT
VALUES{2} "param", aComponentsIndex, aComponentsDescription
!! INTERFACE SCRIPT
row_height = 20 ! Set the Height of each input row
for i=1 to 5 ! Loop through each item in the parameters array to display an input
UI_INFIELD{3} param[i], 10, 10+row_height*i, 300, 20 , ! parameter, x,y,width,height
8, "", ! method:dropdown, picture_name: n/a
0, ! images_numer:n/a
0, 0, 0, ! rows_number:n/a, cell_x:n/a, cell_y:n/a,
0, 0, ! image_x:n/a, image_y:n/a,
aComponentsImages, aComponentsDescription, aComponentsIndex ! the arrays containing the images, description and index of the dropdown list
next i
Frustratingly whenever I tried to use "" in place of aComponentsImages it was only giving a warning, but then wasnt working, so i had to create a separate array to story the blank strings for the image component of the UI_INFIELD dropdown.
Anyone else know how to avoid that?