Question on ComboBoxI can create options for Combo Box with pop up tips using something like that (found this experimentally):
Names Default To Here( 1 );
list = {"One" ("This is One"), "Two" ("This is two")};
New Window( "Example",
cb = Combo Box(
list,
selection = cb << GetSelected();
Print( selection );
)
);But then when I look at the selection - it only has "One" or "Two" as a result of << Get Selected.
Two questions:
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?
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:
if(
selection == list[1], doThis,
selection==list[2], doThat
);
But how do I do it when I have pop up tips included?
ScriptingRe: Question on ComboBoxIn your example, List is a list that has 2 entries.
- "One" ("This is One")
- "Two" ("This is two")
The Combo box divides each list entry into Item and tipstr.
selection = cb << GetSelected();
returns only the item
If you want the tipstr returned, you need to use
tipstr = (cb << get items)[cb << Get];
Re: Question on ComboBoxThanks, Jim.
Still not very clear - each entry is a string? Where quotes escaped?
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:
if(
selection == Word(1, list[1], "\!"()"), doThis,
selection==Word(1, list[2], "\!"()"), doThat
);
Re: Question on ComboBoxThere 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
Names Default To Here( 1 );
list = {"One" ("This is One"), "Two" ("This is two")};
tipstr1 = word(4,char(list),"\!"");
which returns
"This is One"