<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: UI Scripting; Managing access to arrays in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/UI-Scripting-Managing-access-to-arrays/m-p/612313#M6734</link>
    <description>&lt;P&gt;What happens if you use&amp;nbsp;&lt;STRONG&gt;ui_listfield&lt;/STRONG&gt;?&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jun 2024 01:45:41 GMT</pubDate>
    <dc:creator>Lingwisyer</dc:creator>
    <dc:date>2024-06-26T01:45:41Z</dc:date>
    <item>
      <title>UI Scripting; Managing access to arrays</title>
      <link>https://community.graphisoft.com/t5/GDL/UI-Scripting-Managing-access-to-arrays/m-p/611734#M6727</link>
      <description>&lt;P&gt;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&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Aurasphere_1-1719300787622.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/64430i3EAA4A83CF61DD70/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Aurasphere_1-1719300787622.png" alt="Aurasphere_1-1719300787622.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Manual states&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Aurasphere_0-1719300069390.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/64406i1D150F5224317607/image-size/large?v=v2&amp;amp;px=999" role="button" title="Aurasphere_0-1719300069390.png" alt="Aurasphere_0-1719300069390.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Aurasphere_0-1719300739966.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/64425i39F91B8C9BC82803/image-size/large?v=v2&amp;amp;px=999" role="button" title="Aurasphere_0-1719300739966.png" alt="Aurasphere_0-1719300739966.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I would like each field to display the field value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jun 2024 10:24:18 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/UI-Scripting-Managing-access-to-arrays/m-p/611734#M6727</guid>
      <dc:creator>Aurasphere</dc:creator>
      <dc:date>2024-06-29T10:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: UI Scripting; Managing access to arrays</title>
      <link>https://community.graphisoft.com/t5/GDL/UI-Scripting-Managing-access-to-arrays/m-p/612313#M6734</link>
      <description>&lt;P&gt;What happens if you use&amp;nbsp;&lt;STRONG&gt;ui_listfield&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 01:45:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/UI-Scripting-Managing-access-to-arrays/m-p/612313#M6734</guid>
      <dc:creator>Lingwisyer</dc:creator>
      <dc:date>2024-06-26T01:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: UI Scripting; Managing access to arrays</title>
      <link>https://community.graphisoft.com/t5/GDL/UI-Scripting-Managing-access-to-arrays/m-p/612327#M6735</link>
      <description>&lt;P&gt;How are you structuring the parameter's array currently?&amp;nbsp; Do you have 24 separate parameters each with an array, or a single parameter with 24 items in the array.&lt;/P&gt;
&lt;P&gt;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 .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ui_infield param[1]  x, y, width, height&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, to get the dropdown list of available items you need to use a index-string pair value set.&lt;/P&gt;
&lt;P&gt;So instead of setting your parameter you are storing the information in to a String, set it to an Integer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then use the following Value code in your Parameter script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dim aComponentsIndex[]
dim aComponentsDescription[]

aComponentsIndex[1] = 1 
aComponentsDescription[1] = "1 - PIERS"
aComponentsIndex[2] = 2
aComponentsDescription[2] = "2 - FOOTINGS"

VALUES{2} "param", aComponentsIndex, aComponentsDescription&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;And an associated example in the Interface Script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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
....&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp; Full script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;!! 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
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Frustratingly whenever I tried to use "" in place of&amp;nbsp;&lt;EM&gt;aComponentsImages&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;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.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone else know how to avoid that?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 05:25:37 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/UI-Scripting-Managing-access-to-arrays/m-p/612327#M6735</guid>
      <dc:creator>scottjm</dc:creator>
      <dc:date>2024-06-26T05:25:37Z</dc:date>
    </item>
  </channel>
</rss>

