Query textScrollList and optionMenuGrp

how do I capture the name of the item selected in the textScrollList and optionMenuGrp?

window scrollWindow;
paneLayout;
textScrollList -numberOfRows 8 -allowMultiSelection true
	-append "one"      -append "two"      -append "three"
	-append "four"     -append "five"     -append "six"
	-append "seven"    -append "eight"    -append "nine"
	-append "ten"      -append "eleven"   -append "twelve"
	-append "thirteen" -append "fourteen" -append "fifteen"
	-selectItem "six"
	-showIndexedItem 4;
showWindow;

window -q ........... scrollWindow; ???

string $optionWindow = `window -title "Example 1"`;
columnLayout;

//	Create  option menu group.
//
string $colors = `optionMenuGrp -label "Colors"`;
menuItem -label "Red";
menuItem -label "Green";
menuItem -label "Left";
menuItem -label "Center";
menuItem -label "Right";

showWindow $optionWindow;

window -q ........... optionWindow; ???

S

for the textScrollList:

string $scrollListSelection[]=textScrollList -q -si < name of scroll list>;

for the optionMenu:
string $optionMenuSelection=optionMenuGrp -q -v < name of optionMenuGrp>;

When you need to querry things like this it is best to name your controls. ie-

textScrollList -numberOfRows 8 -allowMultiSelection true
-append "one" -append "two" -append "three"
-append "four" -append "five" -append "six"
-append "seven" -append "eight" -append "nine"
-append "ten" -append "eleven" -append "twelve"
-append "thirteen" -append "fourteen" -append "fifteen"
-selectItem "six"
-showIndexedItem 4 myTextScrollList;

--g

Thanks GDC,

When do you use the tick marks syntax:

string $scrollListSelection[]=textScrollList -q -si < name of scroll list>;

as opposed to this other syntax:

textScrollList -allowMultiSelection true
-append "one" -append "two" -append "three" myTextScrollList;

????

S

You use the ticks when you want to capture the output of a command to a varible.
In
string $scrollListSelection[]=textScrollList -q -si < name of scroll list>;

I want to know what's selected ( -si ) so I use the ticks.

When the textSrollList is created you don't need the ticks because your not capturing the results to a varible.

Hope that makes sense.
--g