Posts: 197
	Threads: 60
	Joined: Dec 2013
	
	
 
	
	
		Hi,
I have an array of values that I'd like displayed in a list box for the user to select.
for example, the array has blue,red,green
and the list box would pop up
blue
red
green
The array often changes so this listbox needs to be dynamic.
Thanks
	
	
	
	
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		Is it a listbox control in your dialog?
When to populate the listbox?
1. Before showing dialog.
2. While showing dialog, eg when a button pressed.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 197
	Threads: 60
	Joined: Dec 2013
	
	
 
	
	
		re: Is it a listbox control in your dialog?
Sorry, I'm not sure. I don't have a listbox or dialog. I looked at listbox but that seems static. Maybe smart dialog or custom dialog is what I need?
re:When to populate the listbox?
When a button is pressed.
If possible, I want the list to show up when an event trigger occurs.
I'm basically trying to get a list of urls to show up so I can pick one to make a link.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		Macro 
Macro2239 
ARRAY(str) a="one[]two"
str s=a
int i=ShowMenu(s 0 0 2)
if(i>0) out a[i-1]
 
 
	
	
	
		
	Posts: 197
	Threads: 60
	Joined: Dec 2013
	
	
 
 
	
	
	
		
	Posts: 197
	Threads: 60
	Joined: Dec 2013
	
	
 
	
	
		Your example works fine, but I can't get it to work on my code. I tried reading the help file but I can't understand what the two zeroes do. One of them controls the mouse position. The other...well, there's no other zero that I can see in the help file so I'm confused.
My code
a is a two dimension array array. I'd like to get the 2nd dimension to show up so a[2 j] where 2 refers to the 2nd column
str s=a
int i=ShowMenu(s 0 0 2)
if(i>0) out a[2 i-1]
Thank you.
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		str s=a creates multiline text only if a has 1 dimension.
str s
for(i 0 a.len) s.addline(a[2 i])
	
	
	
	
	
 
 
	
	
	
		
	Posts: 197
	Threads: 60
	Joined: Dec 2013
	
	
 
	
	
		It's perfect. Thanks again, Gintaras!