I would like to be able to input a few different tables for an application. I want to be able to set the path before the app runs. How do I create a preference box and what code do I use to call the tables that I set in the box? I want it to resemble this:

  • Meant to add this picture: ![i.stack.imgur.com/zkIre.png] – user15642 Apr 16 '13 at 13:23
  • Do you have the source code for this application ? – Peter Horsbøll Møller Apr 16 '13 at 15:12
  • I do not. I'm new to MapBasic, so I am pretty green to the language and have not done much programming other than a few classes I had in college. – user15642 Apr 16 '13 at 18:44
  • If you don't have the source code it might be tricky to set the default values. That would require that the tool reads some kind of configuration file. What tool are you trying to set these default value in? – Peter Horsbøll Møller Apr 16 '13 at 19:53
  • My question probably wasn't very clear. I want to write an app that opens a text file and creates a table for MapInfo to read and write. I want to be able to set the path at the beginning of the app and have the code pull the text file from the location specified in the beginning. The name of the text file will be different from one use to the next, but the structure of the table will be the same. Therefore, I would like the code to be a general statement that opens a table from the location specified at the start. – user15642 Apr 16 '13 at 20:11

You need to look at a couple of statements in the MapBasic reference guide.

  • The Dialog statement lets you create a dialog.
  • The Control EditText is used to let the user input values in a dialog
  • The Control Button creates a button on the dialog that can call a handler/subprocedure where you for instance can ask the user to pick a file
  • The Alter Control statement lets you alter an existing control on your dialog. Do remember to assign IDs to your control.
  • The FileOpenDlg() function lets you show a dialog where the user can pick any type of file specified by you
  • The Open File statement lets you open a file for input or output
  • The Print # statement lets you write values to a file
  • The Line Input lets you read values from a file

These are the statements and functions that you should have a look at.

  • Thank you for your help. That's exactly what I needed. I am also planning on having my app geocode using MapMarker. I know I can connnect to MapMarker, but I do not know how to set my geocoding preferences once i link to it. Is there any sort of MapBasic window that I can use to copy the code from MapMarker? I don't want the user to have to stop and interactively select the geocoding preferences as they will always be the same. – user15642 May 17 '13 at 15:09
  • Have a look at the MapBasic statements Open Connection Service and Set Connection ... Geocode. I think you can set the preferences thru these. If not I would recommend that you open a new thread for that question – Peter Horsbøll Møller May 21 '13 at 11:40

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.