To open the MapBasic window, on the HOME tab, in the Windows group, click Tool Windows, and click MapBasic from the list. As with any other window, you may resize it or move it to a new location. The window lets you enter MapBasic code or view MapBasic code as MapInfo Pro generates it.
To see how MapInfo Pro carries out a select statement:
- Open the MapBasic window and then open the WORLD table.
- On the TABLE tab, in the Selection group, click SQL Select to open the SQL Select dialog box.
- Type in the expression Pop_1994 > 1000000. Make sure that the Browse Results box is checked.
- Click OK.
The syntax for these commands appears in the MapBasic window as follows:
Open Table "C:\MAPINFO\DATA\WORLD\WORLD.tab" Interactive
Map From World
select * from World where Pop_1994 > 1000000 into Selection
browse * from Selection
The first line is a result of opening the WORLD table. The second line of code is written automatically because the WORLD table displays in a Map window by default. The third line is the syntax for the select statement. The fourth line is the result of selecting the Browse Results check box.
You can also enter MapBasic commands into the MapBasic window. Position your cursor under the browse * from Selection
line and type the following:
Map from Selection
Press Enter after the line, and the command executes. You should see your selection displayed in a Map window.
As stated before, the MapBasic window was primarily designed to assist MapBasic programmers. You can statements and functions in the MapBasic window such as Buffer( ) function or Insert statement.
To find the appropriate usage and syntax for these statements and functions, refer to the MapBasic Reference, which is located in the Documentation folder of your installation directory. The MapBasic Reference provides a comprehensive guide to MapBasic programming statements and functions along with examples.
Displaying or Hiding the MapBasic Window
To display the MapBasic window, on the HOME tab, in the Windows group, click Tool Windows, and click MapBasic from the list.
To hide the MapBasic window, click the context menu button located on the upper-right corner of the MapBasic window. On the menu, click Auto Hide. The MapBasic window minimizes to the bottom of the MapInfo Pro screen. Clicking on the minimized MapBasic window reopens it.
You can perform tasks by typing statements into the MapBasic window or by choosing them from the MapInfo Pro ribbon.