Subscribe Bookmark RSS Feed

How to Grab Items Inside a List Box and pass them to a simple List

csoon1

Community Trekker

Joined:

Feb 9, 2016

I have a List Box that contains "n" items and I don't have control how many items are there. What I want is to simply grab each item and insert them to a list (for more processing). I thought I could simply pass a message "Select All" but I found out it does not work as how I imagined it to be.

 

Let me know if you have suggestions.

 

I was thinking of looping through each item in the list box and have each item "Set Selected" (so that I can Get Selected afterwards). My problem is that I don't know how to determine the number of items in the List Box. I'm not also sure if this idea works.

 

I appreciate any inputs. Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
vince_faller

Super User

Joined:

Mar 17, 2015

Solution

a listbox() or a v/hlistbox()?  

if it's a listbox() you can just listbox << Get Items.  

If it's a vlistbox and you're using Jmp 13 you can do nitems(vlistbox) and loop through them. 

if you're using jmp12- you have to do something like

Names Default to here(1);
new window("Test", 
	vlb = vlistbox(
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
	)
);
l = {};
for(box = vlb<<child, !isempty(box), box = box << Sib, 
	insert into(l, box)
);
2 REPLIES
vince_faller

Super User

Joined:

Mar 17, 2015

Solution

a listbox() or a v/hlistbox()?  

if it's a listbox() you can just listbox << Get Items.  

If it's a vlistbox and you're using Jmp 13 you can do nitems(vlistbox) and loop through them. 

if you're using jmp12- you have to do something like

Names Default to here(1);
new window("Test", 
	vlb = vlistbox(
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
		textbox("1"),
	)
);
l = {};
for(box = vlb<<child, !isempty(box), box = box << Sib, 
	insert into(l, box)
);
csoon1

Community Trekker

Joined:

Feb 9, 2016

@vince_faller. Thank you very much for a thorough answer. "Get Items" did the job for me as it was a ListBox and I am using JMP13.