<?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 Question on ComboBox in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/473963#M71877</link>
    <description>&lt;P&gt;I can create options for Combo Box with pop up tips using something like that (found this experimentally):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
list = {"One" ("This is One"), "Two" ("This is two")};
New Window( "Example",
	cb = Combo Box(
		list, 
		selection = cb &amp;lt;&amp;lt; GetSelected();
		Print( selection );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But then when I look at the selection - it only has "One" or "Two" as a result of &amp;lt;&amp;lt; Get Selected.&lt;/P&gt;&lt;P&gt;Two questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. What kind of data structure is the list above? It's a list of what? list[1] gives me exactly "One"("This is one") - is it a string, or what is it?&lt;/P&gt;&lt;P&gt;2. How do I work with this list, let's say if it was a normal list like {"One", "Two"}, I would put in a script part something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;if(
selection == list[1], doThis,
selection==list[2], doThat
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But how do I do it when I have pop up tips included?&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 18:14:42 GMT</pubDate>
    <dc:creator>miguello</dc:creator>
    <dc:date>2023-06-09T18:14:42Z</dc:date>
    <item>
      <title>Question on ComboBox</title>
      <link>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/473963#M71877</link>
      <description>&lt;P&gt;I can create options for Combo Box with pop up tips using something like that (found this experimentally):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
list = {"One" ("This is One"), "Two" ("This is two")};
New Window( "Example",
	cb = Combo Box(
		list, 
		selection = cb &amp;lt;&amp;lt; GetSelected();
		Print( selection );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But then when I look at the selection - it only has "One" or "Two" as a result of &amp;lt;&amp;lt; Get Selected.&lt;/P&gt;&lt;P&gt;Two questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. What kind of data structure is the list above? It's a list of what? list[1] gives me exactly "One"("This is one") - is it a string, or what is it?&lt;/P&gt;&lt;P&gt;2. How do I work with this list, let's say if it was a normal list like {"One", "Two"}, I would put in a script part something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;if(
selection == list[1], doThis,
selection==list[2], doThat
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But how do I do it when I have pop up tips included?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:14:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/473963#M71877</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-06-09T18:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Question on ComboBox</title>
      <link>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/473989#M71878</link>
      <description>&lt;P&gt;In your example, List is a list that has 2 entries.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;"One" ("This is One")&lt;/LI&gt;
&lt;LI&gt;"Two" ("This is two")&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;The Combo box divides each list entry into Item and tipstr.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;selection = cb &amp;lt;&amp;lt; GetSelected();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;returns only the item&lt;/P&gt;
&lt;P&gt;If you want the tipstr returned, you need to use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;tipstr = (cb &amp;lt;&amp;lt; get items)[cb &amp;lt;&amp;lt; Get];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 00:27:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/473989#M71878</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-03-29T00:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Question on ComboBox</title>
      <link>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/474016#M71883</link>
      <description>&lt;P&gt;Thanks, Jim.&lt;/P&gt;&lt;P&gt;Still not very clear - each entry is a string? Where quotes escaped?&lt;/P&gt;&lt;P&gt;And if I want to use the same list in an if statement in a script for the combobox, I would have to extract the item itself? Like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;if(
selection == Word(1, list[1], "\!"()"), doThis,
selection==Word(1, list[2], "\!"()"), doThat
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Mar 2022 03:09:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/474016#M71883</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2022-03-29T03:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Question on ComboBox</title>
      <link>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/474023#M71886</link>
      <description>&lt;P&gt;There may be a Community member that has a better way of dealing with the Combo Box list structure, but the only way that I figured out how to deal with it is by making the whole list into a string, and then parsing it out with the Word Function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
list = {"One" ("This is One"), "Two" ("This is two")};
tipstr1 = word(4,char(list),"\!"");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which returns&lt;/P&gt;
&lt;PRE&gt;"This is One"&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Mar 2022 04:16:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/474023#M71886</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-03-29T04:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Question on ComboBox</title>
      <link>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/474091#M71891</link>
      <description>&lt;P&gt;The scripting index shows that structure for tip strings in the combo box.&amp;nbsp; I never realized you could include tooltips with a combobox - neat feature.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pmroz_0-1648558827313.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41244iC080DC71D9F2E62C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pmroz_0-1648558827313.png" alt="pmroz_0-1648558827313.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can create the "real" list from the list with tooltips.&amp;nbsp; Also I'd refrain from using "list" as a variable, as it is a function in JSL.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
list_tips = {"One" ("This is One"), "Two" ("This is two")};
New Window( "Example",
	cb = Combo Box(
		list_tips, 
		selection = cb &amp;lt;&amp;lt; GetSelected();
		Print( selection );
	)
);

mylist = {};
for (i = 1, i &amp;lt;= nitems(list_tips), i++,
	pq = contains(list_tips[i], "(\!"");
	mylist[i] = substr(list_tips[i], 1, pq - 1);
);

if (
	selection == mylist[1], doThis,
	selection == mylist[2], doThat
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Mar 2022 13:04:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Question-on-ComboBox/m-p/474091#M71891</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2022-03-29T13:04:43Z</dc:date>
    </item>
  </channel>
</rss>

