<?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 Use 3 buttons to select 3 different options from the same parameter? in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Use-3-buttons-to-select-3-different-options-from-the-same/m-p/230784#M1528</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;How can I have 3 separate buttons that can select a different option from the same parameter?&lt;BR /&gt;
&lt;BR /&gt;
This is code that I've adapted from another object I have. Any help is appreciated.&lt;BR /&gt;

&lt;PRE&gt;	ui_infield{3} "existing", 0, 100, 100, 20,
	5, "", 1, 1,
	100, 100, 100, 100,
	1, e1,e1

	ui_infield{3} "existing", 0, 130, 100, 20,
	5, "", 1, 1,
	100, 100, 100, 100,
	1, e2,e2

	ui_infield{3} "existing", 0, 160, 100, 20,
	5, "", 1, 1,
	100, 100, 100, 100,
	1, e3,e3&lt;/PRE&gt;&lt;/R&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 24 Mar 2020 13:38:45 GMT</pubDate>
    <dc:creator>JGoode</dc:creator>
    <dc:date>2020-03-24T13:38:45Z</dc:date>
    <item>
      <title>Use 3 buttons to select 3 different options from the same parameter?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-3-buttons-to-select-3-different-options-from-the-same/m-p/230784#M1528</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;How can I have 3 separate buttons that can select a different option from the same parameter?&lt;BR /&gt;
&lt;BR /&gt;
This is code that I've adapted from another object I have. Any help is appreciated.&lt;BR /&gt;

&lt;PRE&gt;	ui_infield{3} "existing", 0, 100, 100, 20,
	5, "", 1, 1,
	100, 100, 100, 100,
	1, e1,e1

	ui_infield{3} "existing", 0, 130, 100, 20,
	5, "", 1, 1,
	100, 100, 100, 100,
	1, e2,e2

	ui_infield{3} "existing", 0, 160, 100, 20,
	5, "", 1, 1,
	100, 100, 100, 100,
	1, e3,e3&lt;/PRE&gt;&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 24 Mar 2020 13:38:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-3-buttons-to-select-3-different-options-from-the-same/m-p/230784#M1528</guid>
      <dc:creator>JGoode</dc:creator>
      <dc:date>2020-03-24T13:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Use 3 buttons to select 3 different options from the same parameter?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-3-buttons-to-select-3-different-options-from-the-same/m-p/230785#M1529</link>
      <description>The script is correct. Just you need to add to parameter script this line:&lt;BR /&gt;
&lt;BR /&gt;
VALUES "existing", e1, e2, e3&lt;BR /&gt;
&lt;BR /&gt;
And do not forget to define e1, e2 and e3 variables before execution of both commands - better in master script.&lt;BR /&gt;
The way how your script is written, "existing" and e1, e2, e3 must be strings.</description>
      <pubDate>Sun, 23 May 2021 12:32:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-3-buttons-to-select-3-different-options-from-the-same/m-p/230785#M1529</guid>
      <dc:creator>Podolsky</dc:creator>
      <dc:date>2021-05-23T12:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Use 3 buttons to select 3 different options from the same parameter?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-3-buttons-to-select-3-different-options-from-the-same/m-p/230786#M1530</link>
      <description>There are actually a few different ways to do this depending on what you want the UI to look like.&lt;BR /&gt;
&lt;BR /&gt;
Podolsky is correct; first you need to set the parameter with the list of values in the master script (or parameter script but master is better).&lt;BR /&gt;
&lt;BR /&gt;
Then you have options in the UI of:&lt;BR /&gt;
USE the "ui_infield" command as you have done, which is probably the worst way (sorry, harsh but true).&lt;BR /&gt;
or&lt;BR /&gt;
USE the "ui_radiobutton" command, which I think is purpose built for exactly what you are trying to do. your UI script would look like this:&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ui_radiobutton "existing", e1, e1, 	xPOS, 	yPOS, 20, 16: xPOS = xPOS +20
ui_radiobutton "existing", e2, e2, 	xPOS, 	yPOS, 20, 16: xPOS = xPOS +20
ui_radiobutton "existing", e3, e3, 	xPOS, 	yPOS, 20, 16: xPOS = xPOS +20
&lt;/PRE&gt;

&lt;BR /&gt;
of&lt;BR /&gt;
If you want a really nice UI with picture button that change based on the chosen button then USE&lt;BR /&gt;
Use the "ui_button" command with the "ui_function" setting and assign a GLOB_UI_BUTTON_ID at the end:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ui_button ui_function, e1, 	xPOS, 	yPOS, 20, 16, 101: 	xPOS = xPOS +20
ui_button ui_function, e2, 	xPOS, 	yPOS, 20, 16, 102: 	xPOS = xPOS +20
ui_button ui_function, e3, 	xPOS, 	yPOS, 20, 16, 103: 	xPOS = xPOS +20
&lt;/PRE&gt;

&lt;BR /&gt;
and then in the parameter script write the response to this button being clicked like:&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;if GLOB_UI_BUTTON_ID = 101 then parameters "existing" = e1
if GLOB_UI_BUTTON_ID = 102 then parameters "existing" = e2
if GLOB_UI_BUTTON_ID = 103 then parameters "existing" = e3
&lt;/PRE&gt;

&lt;BR /&gt;
I hope that helps and doesn't confuse things further as having options often does. Basically, if you just need a check box for each option then use the "ui_radiobutton" as it is simple and fast to set up. If you want buttons with images or text then you need to use the last option.&lt;BR /&gt;
&lt;BR /&gt;
Enjoy,</description>
      <pubDate>Sun, 23 May 2021 23:19:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-3-buttons-to-select-3-different-options-from-the-same/m-p/230786#M1530</guid>
      <dc:creator>Kristian Bursell</dc:creator>
      <dc:date>2021-05-23T23:19:21Z</dc:date>
    </item>
  </channel>
</rss>

