<?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 Get default value of combo box without change in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Get-default-value-of-combo-box-without-change/m-p/678972#M86524</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to get a default value without any click?&lt;/P&gt;&lt;P&gt;I want to save the default value in a variable which in this case should be "one". Any Suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I tried&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example",
	cb = Combo Box(
		{"One", "Two", "Three"},
		&amp;lt;&amp;lt;set function(function({self},
		cb &amp;lt;&amp;lt; set(1, runscript(1));
		selection = cb &amp;lt;&amp;lt; GetSelected();
		Print( "Selected: " || selection )));
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Sep 2023 18:03:29 GMT</pubDate>
    <dc:creator>Jackie_</dc:creator>
    <dc:date>2023-09-18T18:03:29Z</dc:date>
    <item>
      <title>Get default value of combo box without change</title>
      <link>https://community.jmp.com/t5/Discussions/Get-default-value-of-combo-box-without-change/m-p/678972#M86524</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to get a default value without any click?&lt;/P&gt;&lt;P&gt;I want to save the default value in a variable which in this case should be "one". Any Suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I tried&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example",
	cb = Combo Box(
		{"One", "Two", "Three"},
		&amp;lt;&amp;lt;set function(function({self},
		cb &amp;lt;&amp;lt; set(1, runscript(1));
		selection = cb &amp;lt;&amp;lt; GetSelected();
		Print( "Selected: " || selection )));
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2023 18:03:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-default-value-of-combo-box-without-change/m-p/678972#M86524</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2023-09-18T18:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get default value of combo box without change</title>
      <link>https://community.jmp.com/t5/Discussions/Get-default-value-of-combo-box-without-change/m-p/679008#M86527</link>
      <description>&lt;P&gt;I would probably do something like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;default = (cb &amp;lt;&amp;lt; Get Items)[1];&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2023 18:39:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-default-value-of-combo-box-without-change/m-p/679008#M86527</guid>
      <dc:creator>mmarchandTSI</dc:creator>
      <dc:date>2023-09-18T18:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get default value of combo box without change</title>
      <link>https://community.jmp.com/t5/Discussions/Get-default-value-of-combo-box-without-change/m-p/679241#M86542</link>
      <description>&lt;P&gt;I usually use initialization values at the start of script (or configuration file). Below is simple example how those could be used here&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
cb_vals = {"One", "Two", "Three"};
init_cb_val = "Two";

New Window("Example",
	cb = Combo Box(
		cb_vals,
		&amp;lt;&amp;lt;set function(
			Function({self},
				selection = cb &amp;lt;&amp;lt; GetSelected();
				Print("Selected: " || selection);
			)
		),
		&amp;lt;&amp;lt; Set(Contains(cb_vals, init_cb_val), 1)
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then initialize the selectors final value with same init_cb_val if you want to&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 07:53:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-default-value-of-combo-box-without-change/m-p/679241#M86542</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-09-19T07:53:11Z</dc:date>
    </item>
  </channel>
</rss>

