I have a lot of maps (over 600) to create. They all contain the same column titles and the layouts will be the same. I don't want to have to go through and repeat the same process everytime, I would like to just have to open the file and have it map on its own. I have created a workspace to open the other tables I need for every map, but I need to know if it is possible to write a program or code with mapbasic to ask the user to specify what table to open, then using that finish the program by joining the tables and mapping. The first and last parts I can do. I just need to know how to create a dialog box to have the user select the table, or if it is even possible.

  • 4
    What GIS software are you utilizing? How's your programming knowledge? – MLowry Jun 13 '12 at 13:54
  • mapbasic assumes it is for MapInfo - it is possible to automate if you can code. – Mapperz Jun 13 '12 at 14:01
  • Yes I am using MapInfo. I've got a solid programming base. – Shelby Bruns Jun 13 '12 at 14:37

There are two solutions in MapBasic to let the user select the table. I wrote down the related code samples. In the first way, the user can cancel the operation. In that case mypath will be an empty string. However, in the second way, MapInfo gives you an error when the user cancel the operation.

First way:

dim mypath as string
mypath = fileopendlg("C:\", "hello", "TAB", "hello")

Second way:

open table "C:\foo.tab" interactive
| improve this answer | |

Yes it is indeed possible to create a dialog box to have the user select a table. Here's a link to the mapbasic 11 reference manual. Page 93 contains the information you require.

| improve this answer | |

If you want to customize your dialog box you can use the .NET-platform, there is a good sample of how to make the connection at {yourMapInfoInstallationFolder}\MapInfo\MapBasic\Samples\DOTNET\HelloWorld.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.