<?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 Betreff: How to create a list from an array in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646612#M7342</link>
    <description>&lt;P&gt;If you want to use a general code, I recommend declaring the array values in the master script and applying them in a simple way in the parameter script and interface script in the commands. Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;! Master-Script

DIM _einheit_V_text[], _einheit_V_pic[], _einheit_V_value[]
i = 1
_einheit_V_text[i] = "Kubikmeter" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Liter" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikzentimeter" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikmillimeter" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikfuß" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikzoll" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikyards" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Gallone" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1

! Parameter-Script

VALUES{2} "int_einheit_V", _einheit_V_value, _einheit_V_text 

! Interface-Script

UI_OUTFIELD "", 10, 10, 100, 20
UI_INFIELD{3} "int_einheit_V", 120, 10, 100, 20,
8, "",
0, 0, 0, 0, 0, 0,
_einheit_V_pic, _einheit_V_text, _einheit_V_value&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you see, you can shorten the code of VALUES{2}&amp;nbsp; and UI_INFIELD{3}&lt;/P&gt;</description>
    <pubDate>Sat, 18 Jan 2025 18:08:47 GMT</pubDate>
    <dc:creator>Jochen Suehlo</dc:creator>
    <dc:date>2025-01-18T18:08:47Z</dc:date>
    <item>
      <title>How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646580#M7338</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following code that creates an array. When I go to the UI preview window, it results in an array dialogue (see image 1). Is there a way to make it into a dropdown list instead? I can do it with parameter lists but I was hoping I could do it with arrays, but they seem super complex...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;!! Master Script&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DIM Test_Nam[5]
Test_Nam[1] = `Option 1`
Test_Nam[2] = `Option 2`
Test_Nam[3] = `Option 3`
Test_Nam[4] = `Option 4`
Test_Nam[5] = `Option 5`

PARAMETERS Test_Nam[1] = Test_Nam[1]
PARAMETERS Test_Nam[2] = Test_Nam[2]
PARAMETERS Test_Nam[3] = Test_Nam[3]
PARAMETERS Test_Nam[4] = Test_Nam[4]
PARAMETERS Test_Nam[5] = Test_Nam[5]

values{2} "Test_Nam", 0, "Option 1",
1, "Option 2",
2, "Option 3",
3, "Option 4",
4, "Option 5"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;!! UI Script&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ui_infield{2} "Test_Nam", 110, 100, 100, 160&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;My hope is to declare an array and then have the User Interface select an item from that array.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Many thanks,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;From Matt&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image 1.PNG" style="width: 596px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/82054i905B72950EB44E50/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image 1.PNG" alt="Image 1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 23:09:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646580#M7338</guid>
      <dc:creator>GDL Enthusiast</dc:creator>
      <dc:date>2025-01-21T23:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646583#M7339</link>
      <description>&lt;P&gt;It is possible, I believe I ended up finding what I needed to know on alternative sites, that being said I'll have to open things up but I'll post some examples after I finish some work if someone else doesn't post in the meantime&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2025 00:15:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646583#M7339</guid>
      <dc:creator>SenecaDesignLLC</dc:creator>
      <dc:date>2025-01-18T00:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646598#M7340</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Try this:&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DIM _Test_Nam[5] , numbers[5]
_Test_Nam[1] = `Option 1`
_Test_Nam[2] = `Option 2`
_Test_Nam[3] = `Option 3`
_Test_Nam[4] = `Option 4`
_Test_Nam[5] = `Option 5`
numbers[1]=1
numbers[2]=2
numbers[3]=3
numbers[4]=4
numbers[5]=5&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;values{2} "Test_Nam", numbers, _Test_Nam&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Jan 2025 23:10:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646598#M7340</guid>
      <dc:creator>Pertti Paasky</dc:creator>
      <dc:date>2025-01-21T23:10:26Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646603#M7341</link>
      <description>&lt;P&gt;For a nice display in the UI you should use ui_infield{3} with 8 as method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;ui_infield{3} "myParam", posx, posy, inFldWdt, inFldHgt,
 		8, "", 3, 1, 0, 0, 0, 0,
 		"", "Option 1", 1,
 		"", "Option 2", 2,
 		"", "Option 3", 3
   .....&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 18 Jan 2025 14:51:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646603#M7341</guid>
      <dc:creator>runxel</dc:creator>
      <dc:date>2025-01-18T14:51:17Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646612#M7342</link>
      <description>&lt;P&gt;If you want to use a general code, I recommend declaring the array values in the master script and applying them in a simple way in the parameter script and interface script in the commands. Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;! Master-Script

DIM _einheit_V_text[], _einheit_V_pic[], _einheit_V_value[]
i = 1
_einheit_V_text[i] = "Kubikmeter" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Liter" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikzentimeter" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikmillimeter" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikfuß" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikzoll" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Kubikyards" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1
_einheit_V_text[i] = "Gallone" : _einheit_V_pic[i] = "" : _einheit_V_value[i] = i : i = i + 1

! Parameter-Script

VALUES{2} "int_einheit_V", _einheit_V_value, _einheit_V_text 

! Interface-Script

UI_OUTFIELD "", 10, 10, 100, 20
UI_INFIELD{3} "int_einheit_V", 120, 10, 100, 20,
8, "",
0, 0, 0, 0, 0, 0,
_einheit_V_pic, _einheit_V_text, _einheit_V_value&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you see, you can shorten the code of VALUES{2}&amp;nbsp; and UI_INFIELD{3}&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2025 18:08:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646612#M7342</guid>
      <dc:creator>Jochen Suehlo</dc:creator>
      <dc:date>2025-01-18T18:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646648#M7343</link>
      <description>&lt;P&gt;Hi Pertti,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is such a great solution, and it produces the drop down list perfectly. I had no idea I could declare more than one array on the same line until I saw it here and in Jochen's response. So much knowledge you all have!!! Thank you so much Pertti, from Matt&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2025 23:55:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646648#M7343</guid>
      <dc:creator>GDL Enthusiast</dc:creator>
      <dc:date>2025-01-19T23:55:21Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646649#M7344</link>
      <description>&lt;P&gt;Hi Jochen,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is very cool, an expandable solution with clean scripting - very fun! Thank you so much for your answer and elegant coding. I now can have fun with arrays! Many thanks Jochen from Matt&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2025 23:58:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646649#M7344</guid>
      <dc:creator>GDL Enthusiast</dc:creator>
      <dc:date>2025-01-19T23:58:49Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646650#M7345</link>
      <description>&lt;P&gt;Thank you Runxel, I do like both the infield{2} standard and the infield{3} with method 8 option for visual appearance. 95% of my battle is just getting the code to work! Wishing you all the best, from Matt&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 00:02:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646650#M7345</guid>
      <dc:creator>GDL Enthusiast</dc:creator>
      <dc:date>2025-01-20T00:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list from an array</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646651#M7346</link>
      <description>&lt;P&gt;Thank you Seneca, most appreciate your being available. Several great solutions below from Pertti,&amp;nbsp;Jochen. Wishing you all the best, Matt&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 00:04:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-create-a-list-from-an-array/m-p/646651#M7346</guid>
      <dc:creator>GDL Enthusiast</dc:creator>
      <dc:date>2025-01-20T00:04:14Z</dc:date>
    </item>
  </channel>
</rss>

