Hi,

Stolen and modified from Peters repository :)


Include "MapBasic.DEF"

Declare Sub Main
Declare Function GetTableName(ByVal DlgTitle as string) as string


Sub Main
        Print GetTableName("Select table")
end sub

Function GetTableName(ByVal DlgTitle as string) as string
        Dim nTab, i, chosen as smallint
        Dim arrTab(0) as string

        nTab = NumTables()
        ReDim arrTab(nTab)

        for i = 1 to nTab
                arrTab(i) = TableInfo(i,TAB_INFO_NAME )
        next

        Dialog
                Title DlgTitle
                Control PopupMenu
                        Width 200
                        Title From Variable arrTab
                        Into chosen
                Control OKButton
                Control CancelButton

        If Not CommandInfo(CMD_INFO_DLG_OK) Then
                GetTableName = ""
                Exit Function
        End If

        If arrTab(chosen) = "Selection" Then
                GetTableName = SelectionInfo(SEL_INFO_SELNAME)  'use
permanent name
        Else
                GetTableName = arrTab(chosen)
        End If

End Function

HTH,

Jakob Lanstorp
Software Consultant
Geographical Information & IT

COWI A/S
Odensevej 95
5260 Odense S.

Tel +45 6311 4900
Fax +45 6311 4949
Mob +45 5050 8087
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
http://www.cowi.com


-----Original Message-----
From: Carolyn Bergin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 05, 2005 5:21 AM
To: mapinfo-l@lists.directionsmag.com
Subject: MI-L MapBasic - returning the names of current layers into a
popup menu


Hi list

Im sure this is a simple one but being relatively new, Im trying to
populate a popup menu with a list of currently open tables for the user
to select from.  

Ive been searching the help all morning but it seem to be escaping me.

Any hints

TIA

Carolyn 


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 18136

Reply via email to