Free MapBasic Development Environment: MapBasic IDE
Last update: November 30, 2015
MapBasic IDE 1.7 Beta1 Released
Although being an important language, MapInfo (now PB) interestingly made almost no improvements to the MapBasic Editor. To see that, look at the older versions of MapBasic, say 10 years ago, and unfortunately you will see no improvements for developer convenience or productivity.
Therefore, as a developer who is used to utilize and likes great IDEs like Eclipse and Visual Studio (Eclipse is absolutely #1 for me with regard to coding!), I have decided to write a new editor for MapBasic to boost developer productivity. I made MapBasic IDE inherit and inspire a lot of handy features (form designer, syntax highlighting, code completion, syntax check, code snippets, shortcuts etc.) from Eclipse and Visual Studio.
I have written MapBasic IDE using Visual Studio 2010 and C#. The code editor is SharpDevelop’s text editor component.
MapBasic IDE looks like a mini Visual Studio:
MapBasic IDE in code view
MapBasic IDE in design view
- Automatic project build
- External tools (AKA user tools)
- Smart tags
- More project-oriented system
- Auto completion for open MapInfo table names
- Auto completion for table column names
- Auto completion and syntax highlighting is updated to MapBasic 12.5
- Output pane to diplay external tool execution and build info.
- MapBasic 12.5 new help format support
- Highlighting of TODO, FIXME, HACK and UNDONE tags
- Highlight occurrences color setting in theme files
- Disable property added to the StaticText control of dialog designer (Thanks to Nyall Dawson for pointing this undocumented feature)
- Close Others menu item in document tab context menu
- Code editor right click position fixed.
- After jumping to a line (e.g. to a compilation error) the line is centered vertically.
- You can create and run your MBX files in folders different from the project (*.mbp) file.
- Add/Remove MapBasic Installation Path, Custom Code Snippets, New/Edit Custom Code Snippet dialogs made resizable.
- Close All behavior has been standardized.
- Shortcut keys of the toolbar buttons are displayed in their tool tips.
- Project menu renamed to Build.
- Settings menu renamed to Tools.
- Goto Declaration context menu of the code editor renamed to Goto Sub/Function Implementation.
- Code > Fold/Unfold menu item renamed to Code > Fold/Unfold All and its short keys are changed from Ctrl+Shift+F to Ctrl+Alt+F. (Ctrl+Shift+F has been assigned for the advanced Find/Replace dialog, which will be implemented in the next version.)
- The shortcut keys of the Search > Next Error menu item is changed from Ctrl+Shift+N to Ctrl+Shift+E. (Ctrl+Shift+N has been assigned for File > New Project.)
- Error List context menu removed. The same functionality implemented in a toolbar at top of the Error List pane.
- You will not get “No undo group should be open at this point” error message when you undo. But you may have intermittent redo info losses. Hence do not heavily rely on undo and redo operations and do use source control programs or take backups. (I will research for it later.)
- Space character problem in the project (*.mbp) files fixed.
- Goto Declaration feature was going to wrong line in some situations. Fixed.
- Copying a link error in the Error List pane was getting an incomplete error message. Fixed.
- When all documents are closed, Find and Replace form is closed. (Using the form had caused a run-time exception.)
- Dialog Designer
- Syntax highlighting
- Extended code completion
- Method insight
- Syntax (compile) error check while typing
- Highlighting occurrences
- Automatic project build
- Code folding + User defined foldable code blocks
- Code snippets + User defined code snippets
- External tools (AKA user tools)
- Smart tags
- Code surrounding
- Cycle Clipboard Ring
- Auto-saving documents every 2 minutes
- Multiple tabs for documents
- New Project / Item Dialog
- MapBasic Project (MBP) support
- 64-bit Windows support
- Multiple MapBasic version support on a single machine
- Duplicating line or selection
- Moving current line up/down
- Toggling comments
- Going to last edit location
- Going to subs/functions
- Going to declaration
- Editor zoom in/out
- Setting code font type and size
- Context sensitive MapBasic help
- Unlimited undo/redo
- Block indent/outdent
- Brace match highlighting
- Current line highlighting
- Line numbers
- Line selection from left margin
- Shortcut keys
- File system watching for currently edited documents
- Color themes
- Drag & drop support to open files
SOME PLANNED FEATURES
- Advanced find/replace
- Debugging tools
- Code refactoring
Happy coding & enjoy!
COMMENTS, SUGGESTIONS AND FEEDBACKS
Please do not hesitate to comment or give any feedbacks. You can enter them in the comment section on the bottom of this page or directly email to me. Of course there may be some bugs in MapBasic IDE, like any other software in the world. If you encounter any problems or bugs, please report them together with error messages and stack traces. You can get the last error message text at the end of the error log file. You can open the log file via Help > Open Error Log menu.
- You must have the .NET Framework 4.0 Full or above installed. You can download it from:
- You must have MapBasic installed to compile your programs. If you do not have, you can still write programs with MapBasic IDE but you cannot produce MBX files.
- Use back slashes (\) and relative paths in your project (*.mbp) files. In other words, do not use absolute paths or the “Local: …” syntax. For example, rather than using Application=C:\MB\CODE\CUSTOM.MBX or Application=Local:MapBasic:custom.mbx, use like Application=Bin\MyProject.MBX or Application=..\MyProject.MBX. The same rules apply for your Module=… definitions in the project files.
- Do not use non-English characters in your folder or document names. This may prevent some features to work correctly. (I will inspect this later.)
- Undo and redo operations in the dialog designer have some issues. For example, some controls may disappear in the designer after you undo or redo. (I have experienced this intermittent issue a few times.) Hence do not rely on these two operations too much. Please save your work frequently while working with the designer. If you encounter a problem, you can revert your work to its last saved state via File > Revert menu.
- Never close the Toolbox, Properties or Error List windows. If you do so, you will experience some problems. For example, if you close the Properties window, even if you reopen it from the View menu, you cannot display the selected control’s properties while working with the dialog designer. If you, for instance, close the Error List window, Next Error and Previous Error menu items will not function. If you close one of them by mistake, please restart MapBasic IDE. When writing code rather than working with the designer, you naturally might not want to see the Toolbox, Properties or Error List windows, and if this is the case, simply minimize them to the left, right or bottom, respectively.
- Please do not open files by double clicking or right clicking and selecting Open with > MapBasic IDE. There are some issues with this. (I will fix it.) You can open your projects or documents using the Open Project/Open File menu or buttons, File > Recent Files menu or drag & drop.
64-bit WINDOWS SUPPORT
- I rebuilt MapBasic IDE so that it can run with both 32-bit and 64-bit systems. I am able to run it with both 32-bit Windows XP and 64-bit Windows 7. I could not find a chance to test with 64-bit Windows XP. Some people reported that it runs with 64-bit XP. There was a problem with an older version causing a crash upon program exit. Now it appears to be gone but please let me know if you have any issues.
- You may experience compatibility issues with 64-bit systems and may try switching to Windows XP compatibility mode.
- You may also experience path access errors and may need to give appropriate permissions or provide other solutions.
UNINSTALLING MAPBASIC IDE
You can uninstall MapBasic IDE from Control Panel > Add / Remove Programs.
A CLOSER LOOK TO SOME FEATURES
MapBasic IDE’s integrated dialog designer consists of a design surface (dialog form), a toolbox and a properties window much like Visual Studio.
The toolbox has all MapBasic controls you will need. To add MapBasic controls to the dialog, simply drag a control from the toolbox and drop it to the dialog. To set a control’s properties, select it on the dialog and edit the values in the properties window.
Dialog files are persisted on your disk as XML based files with .dlg extension. Each dialog file contains one and only one dialog. In other words, for each dialog that you will need in your application, you must create a separate dialog file. You can create a new dialog file using the New Item dialog opened with File > New… menu.
To generate the MapBasic dialog code, simply use the Generate Dialog Code button on the toolbar. If you click this button for the first time for a particular dialog, MapBasic IDE will generate a new MapBasic file with .mb extension and write the dialog code into this file. For example, when you create and work with a dialog file with name MyDialog.dlg, if you click the Generate Dialog Code button then a new file will be created with name MyDialog.mb.
There is an important point with the generated dialog code: If you look at the generated .mb file, you will see a commented line just above the “Dialog” statement. It warns you not to edit or delete that line or below that line. This line is a marker line and looks something like:
'***** DIALOG DESIGNER GENERATED CODE. DO NOT EDIT OR REMOVE THIS LINE OR BELOW THIS LINE! *****
It identifies the start point of the auto-generated dialog code. In other words, all lines under this line will be generated from scratch each time you click the Generate Dialog Code button according to the design you have just made. This means that if you edit these lines (for example add a Calling statement to a button code), then these edits will be overwritten the next time you click the Generate Dialog Code button. Hence, when you need to change a control’s code (again, like adding a Calling statement to a button code), rather than manually editing the .mb file, you must set the buttons Calling property from the designer. When you do so, you do persist the control properties in the right way.
Maybe you are asking right now: “OK, but what if I need subs/functions that will be called from the dialog controls? Simply write them above the marker line. MapBasic IDE designer will not overwrite and will preserve the codes above the marker line.
After you generate your dialog code as mentioned above, you can copy and paste it to the required location in your main MapBasic file. Or maybe you can make some modifications in the .mb file that the designer generated to be able to include it in other MapBasic files. I leave this point open for the community for better ideas. In later versions, we can improve the designer code generation behavior altogether.
There are also a Format menu and a Format toolbar to apply various formatting operations to the controls. For example, you can align the controls, make them equally spaced or same sized, or center them in the dialog.
You can preview your dialog by clicking the Compile and Run toolbar button or simply by pressing the F5 key when you are in the code view.
If you define the Calling property (in the Properties pane) of a dialog or control, you can go to the calling sub handler in the code easily. For this, simply right click the dialog or control and then click View Code. This is analogous to a Visual Studio feature which brings you to the associated handling procedure in the code when you double-click a form or control.
If you have not defined the Handler/Calling property and click View Code, a warning message appears saying that you must set the Handler/Calling property first.
Setting dialog tab orders are easy as clicking the controls in order. To do this, click Edit > Tab Order menu item. Note that the menu item has been checked, meaning that you have entered the tab order setting mode. Then click each control in the order you wish. As you click each control, a control order number is displayed on the control you have just clicked. When you click the last control in the dialog -provided that you have clicked all of the controls- a green info label appears in the dialog saying that “All tab orders assigned.”
At this point you need to exit the tab order setting mode. Click Edit > Tab Order menu again. Now the control order numbers in the dialog are cleared and the Tab Order menu item is unchecked.
MapBasic IDE displays different code items with different colors. As can be seen from below, keywords are blue, strings are brown, predefined functions etc. are pink, constants are orange and comments are green.
These colors are defined in the *.xshd files located in the <installation directory>\theme folder. If you wish, you can customize the colors by editing these files.
TODO, FIXME, HACK and UNDONE tags are also highlighted to easily spot your tasks:
EXTENDED CODE COMPLETION
You do not have to memorize the constants located in MapBasic.def, Menu.def, PaperSize.def and Icons.def anymore. Code completion feature assists you. Just type the first letters and press Ctrl+Space to display the matching items.
To insert the selected item into your code, press Enter or Tab key.
Code completion feature not only supports the constants mentioned above, but also MapBasic keywords, predefined subs, functions, commands or expressions. For instance, the item SelectionInfo() shown above is a MapBasic function.
The reserved words and predefined MapBasic functions in the completion list belong to MapBasic 12.5. (Many thanks to Egge-Jan Polle for his contribution for more complete and updated item list.) The constants in the four *.DEF files mentioned above are read from your MapBasic installation directory, however.
As of MapBasic IDE 1.3, the completion feature has been extended and it includes user-defined sub and function names, types, global, module level and local variable names, and define names. Moreover, the completion covers all items contained in the included files!
Also you can see the fields of a custom Type if you type dot (.) just after the type variable name.
The other code completion feature is using block shortcuts by pressing the Tab key. If you want to write an If block using the shortcut, just write if and immediately press Tab. MapBasic IDE will automatically insert an if block for you.
Here is the list of all block shortcuts:
if : If-End If block
dc : Do-Case block
for : For-Next block
dw : Do-While block
ww : While-Wend block
typ : Type block
sub : Sub-End Sub block
func : Function-End Function block
The completion feature has been extended again and provides the options to complete the open MapInfo table names and column names as denoted below:
To be able to use this feature, a MapInfo Pro instance must be running and it must have open tables, of course.
When calling a sub or function, if you type an opening parenthesis, i.e. “(“, just after the name of the sub/function, then the method insight feature allows you to see the signature, that is parameters and return type (if function), of the sub/function.
AUTOMATIC SYNTAX CHECK WHILE TYPING
A cool feature is automatic syntax check while typing. Actually I must say while saving. For the time being, in order not to slow down MapBasic IDE, I made that decision rather than making intensive checking on every typed character. You can see the red wave line on the line 165 below, which indicates that there is a syntax, that is compile, error on that line. Moreover, the description of the error is displayed on the status bar when you locate the cursor on the error line:
If you have any syntax errors after you save the current document, you can easily navigate to the errors:
- To jump to the next error line, click Search > Next Syntax Error menu or press the Ctrl+. keys.
- To jump to the previous error line, click Search > Previous Syntax Error menu or press the Ctrl+, keys.
When you click or bring the cursor on a word in the code editor, all instances of the word are highlighted, that is marked, in the document. This is not a smart feature in fact. In other words, the highlighting is neither context nor case sensitive. It just marks all the occurrences of the word that the cursor is on. (Again: It is not case sensitive.) But anyway it is an extremely useful feature. It not only marks the occurrences of the variables, variable types, sub or function names, etc. but also spots the exit points of subs or functions, by selecting the Exit word or the function name, respectively. The variable iRowCount is highlighted in the following code:
You can turn on/off this feature using the Toggle Highlight Occurrences button on the toolbar.
You can set the highlight occurrences color in the theme files.
Assume you have been writing MapBasic code nonstop and like mad, say for 30 minutes, and failed to save your document. Then Murphy Laws are in action and you had a power failure. No problem. MapBasic IDE saves your documents every 2 minutes automatically. This feature excludes the dialog (*.dlg) files.
MAPBASIC PROJECT (MBP) SUPPORT
You can do modular programming with MapBasic IDE. In other words, you can create MapBasic project (.mbp) files, link the modules and run the projects within MapBasic IDE.
PROJECT ORIENTED SYSTEM
MapBasic IDE is more project-oriented now. When you create or open a project (*.mbp) file then it means you also select the current project. This is exactly the same as using the Project > Select Project File menu from MapBasic. After selecting the current project, all subsequent link and run operations are performed against this project.
File menu and toolbar have new items related with projects such as New Project, Open Project and Close Project. There is a difference between Close All and Close Project: Close All simply closes all open documents. You can link or run the current project even when all the documents are closed. Close Project, on the other hand, closes all open documents and the project.
Note that when you create or open a project, the name of the project file is displayed in the status bar. If you click this blue link button then the directory of the project file will open in Windows Explorer.
AUTOMATIC PROJECT BUILD
Finally! You can build your MapBasic projects with a single click or key (F6). The build process simply finds the module files from the project (*.mbp) file and compiles all the module (*.mb) files which are newer than their compiled (*.mbo) counterparts. It also checks all the include files recursively if there are any newer ones. If all the modules compiles fine then the project is linked also. In other words, the build process creates/updates the target MBX file.
Please note that when you set the “Check syntax errors on save” option in the Preferences dialog checked, all the module (*.mb) files will already be compiled every time you save the *.mb files, which means that the *.mb files will not be newer than the compiled *.mbo ones. Hence, if you look at the Output pane after a build, you will see that although you change a module (*.mb) file and save it, this *.mb file will not appear to be compiled in the Output pane.
There is also a Rebuild Project menu item under the Build menu, which first cleans, that is, deletes the *.mbx file and all the *.mbo and *.err files, and then builds the project from scratch. If you experience strange behaviors related with the build process, rebuilding the project may solve the issue.
You can save time by using smart tags to perform some actions in MapBasic IDE that you would usually handle manually. Smart tags recognize particular compile errors with a Smart Tag Actions icon (the yellow electricity) to make it easy for you to complete some of the most common tasks to fix the compile error. You can click the Smart Tag Actions icon or press Alt+Enter to choose an appropriate action.
To complete your task, click the Smart Tag Action Menu Item (Add Sub Procedure declaration
above) or press Enter while the menu item is selected.
Note that this is a pretty limited feature and includes only two compile errors:
-No prototype declared for Sub procedure or Function <Sub/Function Name>
-Invalid Sub procedure name: <Sub Name>
In both cases MapBasic IDE offers the same action: Add Sub Procedure/Function declaration depending on you are dealing with a sub or function. When you perform the associated action, MapBasic IDE adds a line to the top of the document something like
Declare Sub SubName()
Hence you do not have to declare subs or functions when you write them for the first time: Directly write the implementation and use the smart tag, and MapBasic IDE will create the declaration for you.
Because of this limited functionality, please feel free to offer new smart tag actions for other compile errors.
ENHANCED FIND/REPLACE DIALOG
The Find and Replace dialog has been redesigned.
Note that an advanced Find and Replace dialog allowing you to perform project-scoped searches will be implemented in the next version.
MULTIPLE MAPBASIC VERSION SUPPORT ON A SINGLE MACHINE
You can specify the MapBasic compiler, that is version, if you have more than one MapBasic installed on your machine. For example, you may want to compile some of your programs with MapBasic 11.0, while the others with the old MapBasic 7.0.
You can specify the MapBasic version via Settings > Set MapBasic.exe Path… menu:
When you run MapBasic IDE for the first time, an info message will appear informing you that you must specify the MapBasic executable that will compile your programs.
Once you specify the MapBasic version, all subsequent compilations will be performed with that version until you change it again. To add or remove MapBasic versions, click the Edit… button, and Add/Remove MapBasic Installation Path dialog will come up:
This dialog has been made resizable.
You can easily add or remove items using the buttons with icons on the right.
You can also view and change the MapBasic version from the status bar of MapBasic IDE. To change, just click the link, and MapBasic.exe Path dialog will open.
CODE SNIPPET SUPPORT
You can insert predefined code blocks such as If-Else, For-Next, Do-Case etc. To insert one, press Alt+Insert, select the item from the list and press Enter or Tab.
To be able to use this feature, there must be no selected text.
USER-DEFINED CODE SNIPPET SUPPORT
Besides the predefined code snippets, you can define your own snippets. This is a very flexible and powerful feature that lets you define whatever code snippets you want. It is especially useful when you define them for frequently used or hard to memorize code segments. It can also reduce your help references. To add a custom code snippet to the cursor location, click the Code > Add Custom Code Snippet… menu or just press Ctrl+Alt+Ins. When the popup list appears, select the snippet and press the Enter or Tab key to insert.
To add, edit or remove the custom code snippets, click the Settings > Edit Custom Code Snippets… menu, and Custom Code Snippets dialog will open:
This dialog has been made resizable.
Sometimes we want to surround one or more lines of code with blocks like if, for-next etc. Then MapBasic IDE comes into play: To surround a code snippet, select it and then press Ctrl+W. From the popup list, select the block you want and press Enter or Tab.
To be able to use this feature, there must be one or more selected lines. To prevent indentation and formatting issues, you must select the entire lines. For that, you can select the line(s) by first putting the cursor on the first column and then pressing Shift+Down Arrow keys.
MapBasic IDE allows you to create and execute custom tools to ease your tasks. Once you have created and configured an external tool, you can call this tool from within MapBasic IDE. For instance you can execute batch files or windows programs. MapBasic IDE’s external tools implementation is the same as the Visual Studio one and analogous to the user tools in UltraEdit.
Adding New Tools
To add an external tool, click Tools > External Tools… menu item. In the External Tools dialog box click Add, and then fill in the information. The explanation of each field follows:
Title: Descriptive name of the tool, which will be displayed under the Tools menu.
Command: Full path of the executable (Batch file or Windows program). Must be a full absolute path.
Arguments: Command line arguments of the command.
Initial directory: Working directory for the process associated with the command, if applicable. This is not necessary when you, for example, specified the full path of a document in the Arguments field.
When you add an external tool, a corresponding menu item is created under the Tools menu:
As an example, the following tool compiles a MapBasic file:
Title: MB Compiler Command: C:\Program Files\MapInfo\MapBasic\Mapbasic.exe Arguments: -server -d "MyTool.mb" Initial directory: C:\MB Tools
or using full path
Title: MB Compiler Command: C:\Program Files\MapInfo\MapBasic\Mapbasic.exe Arguments: -server -d "C:\MB Tools\MyTool.mb"
The following two tools utilize argument and initial directory variables (explained below) and compile the current MapBasic IDE document:
Title: MB Compiler Command: C:\Program Files\MapInfo\MapBasic\Mapbasic.exe Arguments: -server -d "$(DocumentFileName)" Initial directory: $(DocumentDirectory)
or using full path
Title: MB Compiler Command: C:\Program Files\MapInfo\MapBasic\Mapbasic.exe Arguments: -server -d "$(DocumentPath)"
As a second example, the following tool opens Windows Explorer at the directory of the current document in MapBasic IDE: (Note that this feature already exists in MapBasic IDE with Open Containing Folder menu item in the context menu of the document headers.)
Title: Open File Location Command: C:\Windows\explorer.exe Arguments: /root, "$(DocumentDirectory)"
It is possible to execute batch files by passing arguments. The following tool copies a file to a specified location:
Title: Copy Command: D:\Copy.bat Arguments: "C:\File.txt" "E:\File.txt" Initial directory: D:
Here the contents of the Copy.bat file may be something like
copy %1 %2
to accept the source and destination file paths as arguments.
Note that if you have a directory path with blank characters and getting into trouble, in order not to bang into wall, you may need to enclose the path with quotes like “C:\My Tools”.
Executing an External Tool
To execute an external tool, just click the corresponding menu item under the Tools menu. When you execute a tool including a batch file, execution info is displayed in the Output pane like
External tool 'Copy' started at 11:26:42 PM. External tool 'Copy' executing... Execution of the external tool 'Copy' finished successfully at 11:27:01 PM.
If your tool fails, you may want to look at the Output pane since it displays the standard output and standard error of the process belonging to the tool. For example, when you execute a batch file that performs a copy operation and if you fail to specify the right paths, MapBasic IDE prints an output message such as
External tool 'Copy' started at 11:27:10 PM. External tool 'Copy' executing... D:\>copy d:\File.txt e:\File.txt The system cannot find the file specified.
This error message help you debug the tool.
Arguments for External Tools
The following arguments are MapBasic IDE variables that are assigned when you launch an external tool. They can be used in the Arguments and Initial directory fields.
|Document Path||$(DocumentPath)||Full path of the current document.|
|Document Directory||$(DocumentDirectory)||Directory path of the current document.|
|Document File Name||$(DocumentFileName)||File name + extension of the current document.|
|Document File Name Without Extension||$(DocumentFileNameWithoutExtension)||File name of the current document without extension.|
|Document File Extension||$(DocumentFileExtension)||Extension of the current document.|
|Document Selection||$(DocumentSelection)||Selected text of the current document.|
|Project Path||$(ProjectPath)||Full path of the current project (MBP) file.|
|Project Directory||$(ProjectDirectory)||Directory path of the current project (MBP) file.|
|Project File Name||$(ProjectFileName)||File name + extension of the current project (MBP) file.|
|Project Target Path||$(ProjectTargetPath)||Full MBX file path of the current project.|
|Project Target Directory||$(ProjectTargetDirectory)||Directory path of the current project’s MBX file.|
|Project Target Name||$(ProjectTargetName)||File name + extension of the current project’s MBX file.|
To use the variables, click the arrow buttons near the Arguments and Initial directory fields and then select one of the predefined location menu items to insert the variable into the cursor position in the Arguments or Initial directory fields. Here a variable means a value in the Argument column of the above table, $(DocumentPath) for instance.
Using these variables provides an extremely powerful and flexible way to execute external tools and lets you use relative paths like
for the Initial directory field, for example.
CYCLE CLIPBOARD RING
MapBasic IDE’s Code Editor captures all system Copy and Cut operations. If the cut or copied item contains text then it is stored in memory in the Clipboard Ring. The clipboard recalls the last 15 text items that were cut or copied.
This is a powerful feature for quickly copying several pieces of text to a new location or for recalling text that you inadvertently cut.
To use the Clipboard ring:
1) Cut or copy some text from your code. Use Ctrl+X to cut or Ctrl+C to copy. The last item you cut or
copy into the Clipboard Ring is the current item for pasting.
2) Use Ctrl+Shift+V to paste the Clipboard Ring’s current item to the current document.
3) Repeatedly press Ctrl+Shift+V to cycle through the entries in the Clipboard Ring until you get to the one you want to permanently paste in the document. Each time you press Ctrl+Shift+V, the Editor replaces the last entry you pasted from the Clipboard Ring so that you end up with only the last one you selected. The item you stop on then becomes the current item.
4) Move to another location or cancel the selection. You can use Ctrl+Shift+V to paste the current item again or cycle the Clipboard Ring to a new item.
Note that since the implementation of this feature is the same as Visual Studio, I got the above explanation from MSDN.
Folding some parts of the code is useful especially in long programs by shortening the display. You can fold (and unfold of course) sub, function and type blocks by clicking the minus (-) icon on the left of them. To unfold, i.e. open, click the plus (+) icon on the left.
To fold/unfold all the foldable blocks click the Code > Fold/Unfold menu or press Ctrl+Alt+F keys.
USER-DEFINED FOLDABLE CODE BLOCKS
Besides folding the sub, function or type blocks, now you can define custom foldable code blocks. For that, you can use the Region/End Region structure. The custom block must start with
and must end with
as shown below:
DUPLICATING LINE OR SELECTION
For duplicating similar lines or blocks, MapBasic IDE provides a way which is easier than copy-pasting. You can duplicate the current line (the one cursor is on) or selected text. To duplicate, just press Ctrl+D.
NEW FILE DIALOG
You can create new MapBasic files with the new Visual Studio-like New File dialog as shown below:
DISPLAYING THE DOCUMENT PATHS
The full paths of the open files are not displayed in the title bar of MapBasic IDE anymore. Instead, the paths are displayed with a tool tip when your mouse hovers over a document header:
DOCUMENT HEADER (TAB) CONTEXT MENU
If you right-click on a document header, a context menu will popup as shown below:
With this menu you can:
- Save the document
- Copy the document’s full path into the clipboard
- Open the folder containing the document
- Close the documents but the current document, if any
- Close the document
ERROR LIST OPTIONS
There is a toolbar at the top of the Error List pane:
With this toolbar you can:
- Go to the error line
- Copy the error text into the clipboard
- Search the error text in Google (Uses your default browser)
ERROR LOG FILE
The log file that stores your critical MapBasic IDE program error information has been moved from the application directory to your <Local Settings>\Application Data\MapBasicIDE folder. Furthermore, you can open and see the logs via Help > Open Error Log menu. You can use this when you want to report (please do so!) the program errors you encounter.
DRAG AND DROP SUPPORT TO OPEN FILES
You can use drag and drop to open files with MapBasic IDE. You can drag multiple files.
ASSOCIATION WITH MAPBASIC FILES
If you associate the MapBasic file types with MapBasic IDE, you can open these files with MapBasic IDE by double clicking on them.
DELETING CURRENT LINE
To delete the current line (the one cursor is on) quickly, click the Code > Delete Current Line menu or press Alt+Del.
MOVING LINES UP/DOWN
You can move the current line up or down by using the shortcuts Alt+Up and Alt+Down respectively. No need to cut-paste.
You can comment/uncomment a single line or selected lines by Ctrl+7.
GOING TO LAST EDIT LOCATION
To quickly navigate to the last edit location in code, press Ctrl+Q.
GOING TO SUBS/FUNCTIONS
There may be a lot of subs or functions in large MapBasic documents. To cope with those, MapBasic IDE presents a handy feature to access to subs or functions quickly. Just press Ctrl+Shift+O and a list will appear. From the list, select the sub/function to go and press Enter. To cancel, press Esc. Moreover, while you are typing the name of the sub/function, the list will be filtered accordingly.
GOING TO DECLARATION
To navigate to he declaration of a sub or function, right click the sub/function name where it is called and click Goto Declaration, or press F3 while the cursor is on the name of the sub/function.
You can set several settings with Preferences dialog. You can set:
- Tab width, font and color theme of the editor.
- Dialog designer grid on/off, plus grid width and height.
- Turn on/off the syntax check feature.
- Turn on/off the auto save feature.
- Turn on/off the highlight occurrences feature.
- Initial directory that will be displayed in new item and open file dialogs as default.
- Whether project module files and include files will be opened as well. If you check these two checkboxes, after you have opened a project (.mbp) file, then all module files in the project file and all include files in a MapBasic (.mb) file will also be opened automatically.
To open the Preferences dialog, click Tools > Options… menu.
SETTING FONT TYPE AND SIZE
To set the type or size of the editor, click the Tools > Options… menu, and then press the Font… link button.
This setting is permanent, and will be persisted even when you exit MapBasic IDE.
INSERTING MAPBASIC COLOR CODE USING COLOR DIALOG
You do not need to deal with MapBasic color codes anymore. To insert a MapBasic color code, click the Edit > Insert Color Code… menu and then select the color you want from the color dialog. Hitting the OK button will insert the MapBasic color code of the selected color into the cursor location.
You can select from a few predefined color themes. To do this, first open the Preferences dialog by clicking the Tools > Options… menu, and then hitting the Theme… link button. You can see the dark (BJK) theme below:
By the way, the names and colors of the current themes (FB, GS, and BJK) come from the major Turkish football teams Fenerbahçe, Galatasaray and Beşiktaş, respectively. 😉
You can also create your custom theme files by copying and modifying the existing ones.
You can bookmark the lines you go often and quickly navigate between them. To use bookmarks, use the sub menus under the Code > Bookmarks menu.
To zoomin/zoomout the currently open MapBasic document, wheel your mouse forward or backward respectively while pressing the Ctrl key. This is a temporary modification to the document, and it has no effect to other open documents if any. To permanently change the editor font size, refer to the section named “Setting Font Type and Size”.
DOCKING SUPPORT FOR DOCUMENTS
You can dock MapBasic documents vertically or horizontally. Just drag the document header (shown with an ellipsis below) and drop to one of the direction icons that appears while you dragging.
Similarly you can dock the documents horizontally. Moreover, you can create both vertical and horizontal combinations provided that there are at least 3 documents.
CONTEXT SENSITIVE MAPBASIC HELP
You can directly access to the MapBasic help document within MapBasic IDE. With context sensitive help support, MapBasic IDE assists you to get the help with just one key. For example, assume that you are currently typing the TableInfo() function, and assume you want to look at this function in MapBasic help. Place the cursor on the word TableInfo and press F1. You are on the TableInfo topic in 1 second!
SEARCHING THE MAPBASIC HELP FROM WITHIN MAPBASIC IDE
In order not to put your hand away from keyboard while coding, MapBasic IDE provides some shortcuts: To focus the MapBasic Help textbox on the upper right, press F11. To focus the code editor, press F12.
MapBasic 12.5 new help format is supported.
Keywords: Free MapBasic editor, IDE for MapBasic, alternative MapBasic editor, MapBasic development environment