Con

 

To populate the listbox, you have to first populate an array.  Here is some code which I have directly cut out of one of my mbx programs.  It fills a multi-list box, which is similar to a list box.

 

dim titleArray(50) as string

 

for i = 1 to tableInfo(theFeatureLayer,TAB_INFO_NROWS)

 

       Fetch Rec i from theFeatureLayer

       titleArray(i) = theFeatureLayer.col1

   next

   redim titleArray(i)

 

Dialog

   Control MultiListBox

   Title From Variable titleArray

   id 2

   Position 5, 25 Width 150 Height 50

   Control CancelButton

   calling shutDownDialog

   Control OKButton

       calling goSomewhere()

end sub

 

sub shutDownDialog()

   'drop table Sel_R1

   Dialog Remove   

end sub

 

Hope this helps

 

Cheers

 

James Kelly

 

Spatial Information Officer

Midway Pty Ltd

150 Corio Quay Road

North Shore Victoria 3215

Tel. +61 3 5277 9255

Fax +61 3 5277 0667

Mob +61 4 3834 5760 (0438 345 760)


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Monday, 15 May 2006 2:36 PM
To: [email protected]
Subject: [MI-L] Populate listbox from table contents

 


Using MapBasic, how does one populate a ListBox with the values in a column?

I have managed to write a snippet of code that loops through the table and picks up the values in a particular column and then populates the Message Window;  but the ListBox Control doesn't appear to have an "Add" or "AddItem" function associated with it (as in VB).

Can this be done in MapBasic? Does anyone have an example?

Regards,
Con Charalambou

Manager – Geographic Information Systems
[EMAIL PROTECTED] | T 61 2 6264 0830 | F 61 2 6253 1911 | M 0404 022 581

GHD
| CLIENTS | PEOPLE | PERFORMANCE
59 Cameron Avenue Belconnen ACT 2617 | http://www.ghd.com.au

 
_____________________________________________________________________
This e-mail has been scanned for viruses by MessageLabs.


Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.
http://www.mailguard.com.au/tt
 
 



Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.
http://www.mailguard.com.au/tt
 
 
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to