Travis Lathrop wrote:

Does anyone have any sample code that shows how to create a dialogue that
will allow the user to select a record based on two fields....etc.  City,
state?

Travis Lathrop
Intercarrier Services
913/762-4806

Here is some old code I once wrote for a dialog example.
It does not exactly what you wants, but any way......compile and see.

Jakob Lanstorp, GIS-Developer

Kampsax   GIS Software & Solutions, Rugaardsvej 55, 5000 Odense, DK
tel: + 45 63 13 50 13, dir: + 45 63 13 50 11, fax: + 45 63 13 50 90
mailto:[EMAIL PROTECTED] , http://www.mapinfo.dk, http://www.kampsax.dk
Authorized MapInfo Partner & Distributor in Denmark and Norway

'-------------------------------------------------
'*Free dialog sample code to be used on own risk. No support on this code
'*To be modify and distributed freely.
'*Jakob Lanstorp, [EMAIL PROTECTED]
'*Kampsax GIS Software & Solutions, Rugaardsvej 55, 5000 Odense, DK
'-------------------------------------------------

Include "mapbasic.def"

Define lf Chr$(10)

Declare Sub Main
Declare Sub GetColumns
Declare Sub GetRecord1
Declare Sub GetRecord2

Dim arrTab() as string
Dim arrCol1() as string
Dim arrCol2() as string
Dim arrRecord1() as string
Dim arrRecord2() as string

Sub Main
     Dim i as integer
     Dim nCol1Into, nCol2Into, nTabInto, nRecord1Into, nRecord2Into as
integer

     '*place tab in array
     For i = 1 to Numtables()
          ReDim arrTab(i)
          arrTab(i) = TableInfo(i, TAB_INFO_NAME)
     Next

     DIALOG
          POSITION 363, 231
          WIDTH 359 HEIGHT 103
          TITLE "Dialog code sample"
          Calling GetColumns

          CONTROL PopUpMenu
               POSITION 51, 10
               WIDTH 130
               ID 10
               TITLE From Variable arrTab()
               CALLING GetColumns
               Into nTabInto
          CONTROL PopUpMenu
               POSITION 51, 33
               WIDTH 130
               TITLE From Variable arrCol1()
               Calling GetRecord1
               VALUE 1
               ID 20
               INTO nCol1Into
          CONTROL PopUpMenu
               POSITION 51, 56
               WIDTH 130
               TITLE From Variable arrcol2()
               Calling GetRecord2
               VALUE 2
               ID 30
               INTO nCol2Into
          CONTROL OKButton
               POSITION 59, 79
               WIDTH 38 HEIGHT 14
               TITLE "OK"
          CONTROL CancelButton
               POSITION 107, 79
               WIDTH 38 HEIGHT 14
               TITLE "Cancel"
          CONTROL StaticText
               POSITION 15, 12
               TITLE "Table"
          CONTROL StaticText
               POSITION 15, 34
               TITLE "Column 1"
          CONTROL StaticText
               POSITION 15, 58
               TITLE "Column 2"

          CONTROL PopUpMenu
               POSITION 203, 35
               WIDTH 132
               ID 40
               TITLE From Variable arrRecord1()
               INTO nRecord1Into
          CONTROL PopUpMenu
               POSITION 203, 57
               WIDTH 132
               ID 50
               TITLE From Variable arrRecord2()
               INTO nRecord2Into
          CONTROL StaticText
               POSITION 205, 21
               TITLE "Record"

     If not CommandInfo(CMD_INFO_DLG_OK) Then
               Exit Sub
     End If

     Print Chr$(12)

     Print "Picked Table: " + arrTab(nTabInto) + lf
               + "Picked column 1: " + arrCol1(nCol1Into) + lf
               + "Picked column 2: " + arrCol2(nCol2Into) + lf
               + "Picked Record 1: " + arrRecord1(nRecord1Into) + lf
               + "Picked Record 2: " + arrRecord2(nRecord2Into)
End Sub

Sub GetColumns
     Dim szTab as string
     Dim i as integer

     '*get selected tab
     szTab = arrTab(ReadControlValue(10))

     'update column popup
     For i = 1 to TableInfo(szTab, TAB_INFO_NCOLS)
          ReDim arrCol1(i)
          arrCol1(i) = ColumnInfo(szTab,"COL"+i,COL_INFO_NAME)
     Next

     Alter Control 20
          Title From Variable arrcol1()
          Value 1

     For i = 1 to TableInfo(szTab, TAB_INFO_NCOLS)
          ReDim arrCol2(i)
          arrCol2(i) = ColumnInfo(szTab,"COL"+i,COL_INFO_NAME)
     Next

     Alter Control 30
          Title From Variable arrcol2()
          Value 2

     Call GetRecord1
     Call GetRecord2
End Sub

Sub GetRecord1
     Dim szCol1, szTab as string
     Dim a as alias
     Dim i as integer

     szTab = arrTab(Readcontrolvalue(10))
     szCol1 = arrCol1(Readcontrolvalue(20))

     a = szTab + "." + szCol1

     Fetch First From szTab
     Do Until EOT(szTab)
          i = i + 1

          ReDim arrRecord1(i)
          arrRecord1(i) = a

          Fetch Next From szTab
     Loop

     Alter Control 40
          Title From Variable arrRecord1()
End Sub

Sub GetRecord2
     Dim szCol2, szTab as string
     Dim b as alias
     Dim i as integer

     szTab = arrTab(Readcontrolvalue(10))
     szCol2 = arrCol2(Readcontrolvalue(30))

     b = szTab + "." + szCol2

     Fetch First From szTab
     Do Until EOT(szTab)
          i = i + 1

          ReDim arrRecord2(i)
          arrRecord2(i) = b

          Fetch Next From szTab
     Loop

     Alter Control 50
          Title From Variable arrRecord2()

End Sub






~~~~~~~~~~~~ List Sponsor ~~~~~~~~~~~~
10 PARTNERS - ONE BIG EVENT
The industry's biggest players have joined forces.  See why EarthWatch, LAND
INFO, ERDAS, Kodak, Hitachi Global Software Technology, Imagelinks, Landata,
Pixxures, Research Systems, and Trimble are so excited they're giving away
over $5,000 in prizes.
http://www.digitalglobe.com/forms/survey.jsp?form=esri_survey.xml&source=directions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to