<?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: Add buttons dynamically in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337319#M2838</link>
    <description>&lt;P&gt;not sure if that is what you were looking for...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1N8-0rHlxeE7StJ23wwTwROxMKqIzpGhW/view?usp=drivesdk" target="_blank"&gt;https://drive.google.com/file/d/1N8-0rHlxeE7StJ23wwTwROxMKqIzpGhW/view?usp=drivesdk&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Apr 2022 13:21:38 GMT</pubDate>
    <dc:creator>A_ Smith</dc:creator>
    <dc:date>2022-04-29T13:21:38Z</dc:date>
    <item>
      <title>Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336068#M2827</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add a button depending on the amount that is selected from the list of values.&lt;/P&gt;&lt;P&gt;For example, in Parameters I have:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VALUES "Shelf_Amount", 1, 2, 3, 4, 5, 6, 7&lt;/LI-CODE&gt;&lt;P&gt;If I select 1 from the list, one buttom will be added, if I select 2, then two buttons will be added and so on. The idea behind this is that each button will control something different, like using a different gosub depending on which button is pushed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to add a simple button on the UI, but not sure how to do it in a dynamically way and with a incremental name per button. I thought that adding the variable name + 1 would do the trick, but did failed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Master:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Button_Name = "Test"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Interface:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;UI_BUTTON UI_FUNCTION, Button_Name, 0, 0, 150, 50&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Juan.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 10:39:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336068#M2827</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-04-19T10:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336094#M2828</link>
      <description>&lt;P&gt;I managed to create (for now) an outfield depending on the value amount, the problem now is that the items are overlaping and not being added with an offset. So I "forced" the y position of each row but I don't know if there is a more modular way to do it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_pageStartY = 5
_yCurr		= _pageStartY
_dy			= 24
_infHeight 	= 19
_outfHeight = 15
_offsetY	= 4

_infWidth = 90
_infWidthShort = 54
_x1	= 0
_x4	= 210
_x2	= _x4 - _infWidth
_x3	= _x4 - _infWidthShort

_xSeparator = 220

_x5 = _xSeparator + 10
_x6 = 315

ui_outfield `No. of Modules`,	_x1, _yCurr,				_x3-_x1-2,	_outfHeight
ui_infield{3} "nModule",		_x3, _yCurr - _offsetY,	_x4-_x3,		_infHeight,
	8, "",
	0, 0, 0, 0, 0, 0,
	0, `1`,	1,
	0, `2`,	2,
	0, `3`,	3,
	0, `4`,	4,
	0, `5`,	5,
	0, `6`,	6	ui_tooltip `No. of Modules`
_yCurr = _yCurr + _dy

ui_outfield `Module 1`,	_x5, _yCurr,	_x6-_x5-2,	_outfHeight

IF nModule &amp;gt; 1 THEN
		ui_outfield `Module 2`,	_x5, _yCurr + _dy,	_x6-_x5-2,	_outfHeight
ENDIF

IF nModule &amp;gt; 2 THEN
		ui_outfield `Module 3`,	_x5, _yCurr + _dy*2,	_x6-_x5-2,	_outfHeight
ENDIF

IF nModule &amp;gt; 3 THEN
		ui_outfield `Module 4`,	_x5, _yCurr + _dy*3,	_x6-_x5-2,	_outfHeight
ENDIF

IF nModule &amp;gt; 4 THEN
		ui_outfield `Module 5`,	_x5, _yCurr + _dy*4,	_x6-_x5-2,	_outfHeight
ENDIF

IF nModule &amp;gt; 5 THEN
		ui_outfield `Module 6`,	_x5, _yCurr + _dy*5,	_x6-_x5-2,	_outfHeight
ENDIF&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 19 Apr 2022 12:38:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336094#M2828</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-04-19T12:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336100#M2829</link>
      <description>&lt;P&gt;You can add a number to a name using a loop. But you have to convert that number to a string and then add it on each new loop.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 13:04:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336100#M2829</guid>
      <dc:creator>SenecaDesignLLC</dc:creator>
      <dc:date>2022-04-19T13:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336268#M2830</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Here is a simpler solution in my opinion&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;!!!!!Parameter Integer
VALUES{2} "nModule" 1,"Module 1",
2, "Module 2",
3, "Module 3",
4, "Module 4",
5, "Module 5",
6, "Module 6"


UI_INFIELD{3} "nModule", 0, 50, 110, 15,
8, "", 6, 1, 0, 0, 0, 0,
1, "Module 1",1,
2, "Module 2", 2,
3, "Module 3",3,
4, "Module 4", 4,
5, "Module 5",5,
6, "Module 6", 6&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 15:56:48 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336268#M2830</guid>
      <dc:creator>Yves</dc:creator>
      <dc:date>2022-04-20T15:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336299#M2831</link>
      <description>&lt;P&gt;Thank you, interesting solution I will test it out.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 06:14:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336299#M2831</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-04-21T06:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336300#M2832</link>
      <description>&lt;P&gt;Thanks, but there is no need to have an IF statement for the ui-infield?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 06:15:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336300#M2832</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-04-21T06:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336304#M2833</link>
      <description>&lt;P&gt;I ended up creating 6 different values one for each option since each one of them can have different object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything works as it should be, but not sure if this is the most optimal way to handle it, mostly because the modularity. I meant, if I add 10 shleves amount, then I would need to add manually as many "Shelfstyles_n" values as needed and then add to the interface as many IF statements as needed as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Better a picture than thousand words :):&lt;/P&gt;&lt;P&gt;Interface:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;UI_OUTFIELD `Shleves Amount`, 0, 30, 65, 15
UI_INFIELD{3} "nShelves", 70, 25, 54, 19,
	8, "",
	0, 0, 0, 0, 0, 0,
	0, `1`,	1,
	0, `2`,	2

IF Shelf_Type = 0 THEN
	UI_INFIELD{3} "ShelfStyles_1", 225 , 25, 83, 35,
			2, 2, 6, 5,			! type chooser pict
			130,102,100,90,
			1, `Style 1`, 1,
			2, `Style 2`, 2,
			3, `Style 3`, 3,
			4, `Style 4`, 4,
			5, `Style 5`, 5,
			6, `Style 6`, 6

	IF nShelves &amp;gt; 1 THEN
			UI_INFIELD{3} "ShelfStyles_2", 225, 65,	83, 35,
					2, 2, 6, 5,			! type chooser pict
					130,102,100,90,
					1, `Style 1`, 1,
					2, `Style 2`, 2,
					3, `Style 3`, 3,
					4, `Style 4`, 4,
					5, `Style 5`, 5,
					6, `Style 6`, 6
	ENDIF
ENDIF&lt;/LI-CODE&gt;&lt;P&gt;Parameters:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VALUES "nShelves", 1, 2
VALUES "ShelfStyles_1" 1,2,3,4,5,6
VALUES "ShelfStyles_2" 1,2,3,4,5,6&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F2cPpNuGtSUw%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2cPpNuGtSUw&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F2cPpNuGtSUw%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="200" height="113" scrolling="no" title="Dynamic UI" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 06:44:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336304#M2833</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-04-21T06:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336316#M2834</link>
      <description>&lt;P&gt;No need to have an IF statement for ui_infield !&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 07:35:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336316#M2834</guid>
      <dc:creator>Yves</dc:creator>
      <dc:date>2022-04-21T07:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336371#M2835</link>
      <description>&lt;P&gt;You just need a for/next loop or two.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 21:46:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336371#M2835</guid>
      <dc:creator>SenecaDesignLLC</dc:creator>
      <dc:date>2022-04-21T21:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336643#M2836</link>
      <description>&lt;P&gt;If all your shelf styles are the same, you can use an array parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VALUES "ShelfStyles" 1,2,3,4,5,6

for i ...
    UI_INFIELD{3} ShelfStyles[i], ...&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This simplifies the UI commands, however you can't use LOCK, HIDEPARAMETER and GLOB_MODPAR_NAME on individual elements of an array parameter. If you need those, create the parameter name with STR functions in the loop.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 07:48:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336643#M2836</guid>
      <dc:creator>Peter Baksa</dc:creator>
      <dc:date>2022-04-25T07:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336649#M2837</link>
      <description>&lt;P&gt;Thank you, yes I have an array in a condition if all the shelves are the same, but there is another condition where the shelves can be different, user's choice.&lt;BR /&gt;&lt;BR /&gt;My script works flawless, just not sure if there is a more optimal way on doing it when all the shelves are different.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 07:52:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/336649#M2837</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-04-25T07:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337319#M2838</link>
      <description>&lt;P&gt;not sure if that is what you were looking for...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1N8-0rHlxeE7StJ23wwTwROxMKqIzpGhW/view?usp=drivesdk" target="_blank"&gt;https://drive.google.com/file/d/1N8-0rHlxeE7StJ23wwTwROxMKqIzpGhW/view?usp=drivesdk&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 13:21:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337319#M2838</guid>
      <dc:creator>A_ Smith</dc:creator>
      <dc:date>2022-04-29T13:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337337#M2839</link>
      <description>&lt;P&gt;Here is a quick video of where i took my shelving object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FS94aCthbWF8%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DS94aCthbWF8&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FS94aCthbWF8%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="200" height="112" scrolling="no" title="BIMRithm Shelves" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 18:49:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337337#M2839</guid>
      <dc:creator>SenecaDesignLLC</dc:creator>
      <dc:date>2022-04-29T18:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337420#M2840</link>
      <description>&lt;P&gt;Yes, exactly what I'm looking after. &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 05:17:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337420#M2840</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-05-02T05:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337421#M2841</link>
      <description>&lt;P&gt;You are using the same hotspot to perform different tasks depending on the direction to where you move it?.&lt;/P&gt;&lt;P&gt;That is fantastic, didn't know that.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 05:15:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337421#M2841</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-05-02T05:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337439#M2842</link>
      <description>&lt;P&gt;I'll post a link in a bit so you can look at it if you are interested.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 13:50:18 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337439#M2842</guid>
      <dc:creator>SenecaDesignLLC</dc:creator>
      <dc:date>2022-05-02T13:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Add buttons dynamically</title>
      <link>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337492#M2843</link>
      <description>&lt;P&gt;Absolutely, very interested on your method.&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 11:38:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Add-buttons-dynamically/m-p/337492#M2843</guid>
      <dc:creator>jc4d</dc:creator>
      <dc:date>2022-05-03T11:38:26Z</dc:date>
    </item>
  </channel>
</rss>

