107 of 158
101 Chapter 6 - The ZBasic IDE The ZBasic integrated development environment is based on the open-source IDE called SciTE. In addition to the basic text editing capabilities, the IDE has the ability to invoke the ZBasic compiler to compile your application and help you navigate to the lines containing errors. It also has the ability to download the code into the ZX and display any output that results. 6.1 Using the Editor The source code editor built into the IDE has features designed especially for editing source code. Before those features are described, we will cover the basic editing capabilities that should be familiar to anyone with prior Windows application usage experience. 6.1.1 Basic Editing As you would expect, typing regular characters (e.g. alphabetic, numeric, punctuation, etc.) causes them to be inserted in the current document at the caret position. If a selection exists at the time, the characters comprising the selection will be first deleted and the typed character will be inserted in its place. The cursor keys (Up, Down, Left, and Right arrows) move the position of the caret. If the either Shift key is held down when a cursor key is pressed, a selection will be begun if none currently exists and the selection will be extended by characters (for Left and Right) or by lines (for Up and Down). If the Ctrl key is also held down, the Left and Right cursor keys will extend the selection by a word at a time. While a selection exists, Ctrl+C will copy the selected characters to the clipboard while Ctrl+X will cut the selected characters to the clipboard. Ctrl+V will paste the current clipboard content into the document at the caret position replacing the currently selected characters, if any. The Home key will move the caret to the first non-space character on the line or, if the caret is already at that position, to the first column of the document. The End key moves the caret to just after the last character on the line whether or not the last character is a white space character. Ctrl+Home moves the caret to the position before the first character of the document while Ctrl+End moves the caret just after the last character of the document. The PageUp and PageDown keys move backward a forward through the document by pages. The Backspace and Delete keys remove the character preceding and following the caret position, respectively. Holding down the Ctrl key while pressing Backspace and Delete serve to magnify their effect, deleting to the beginning and end of a word, respectively. Similarly, holding down both the Ctrl and Shift key magnifies the effect even more; deleting to the beginning of the line and the end of the line, respectively. The editor has the ability to undo (Ctrl+Z) and redo (Ctrl+Y) recent changes. These and other editing commands are available via menu entry as well. 6.1.2 Special Code Editing Features The specialized “lexers” built into the editor recognize certain aspects of the code in a document based on the “extension” portion of the document’s filename. When a document having a .bas extension is loaded, the editor will apply different styles to various portions of the content. This capability, sometimes called “syntax coloring”, helps programmers more quickly identify the syntactic elements of their program and to recognize when a typing error has been made. For example, the editor will display Basic keywords (e.g. If, Else, etc.) in a bold blue font. If you type “Ekse” when you intended “Else”, you’ll immediately see that the editor did not display the mistyped word as a keyword thereby giving you immediate feedback that you erred.