Task 2: The IDE  

NOTE: At a minimum make sure to scroll down to the section titled "Customizing the IDE" to set up your copy of QB64 to match this course.

Most programming languages include an IDE (Integrated Developer Environment) to aid the programmer when writing code. An IDE provides command structure formatting, debugging tools, and real time syntax checking, like a spell checker for commands. The IDE is where the programmer types in the code commands to create a computer program. Let's take a brief tour of the IDE included with QB64. Open the QB64 folder on your desktop then double-click on the QB64 application icon to start the QB64 IDE command editor as seen in Figure 1 below.


Figure 1 - The QB64 Integrated Developer Environment

Cursor: The QB64 IDE acts like any other simple text editor such as Notepad. The flashing cursor depicts where text will be inserted when the programmer strikes a key or pastes text from the clipboard. You can use the keyboard arrow keys or a left mouse click to position the cursor anywhere within your code.

Position of Cursor: The IDE will display the current location of the cursor within your code. The row number is the current line number of your code. This makes it easy to find errors that the IDE reports on a certain line number.

Current Program: When you load source code or save your newly written program for the first time the name you give the source code file name will be displayed here.

Search: You can search the source code for any string of text by entering it in the search bar and pressing ENTER.

Help: Selecting Help brings up a comprehensive help menu of items to aid the programmer. We'll discuss these in more detail as the course progresses.

Errors and other information display here: Any information that the IDE needs to convey to the programmer during the process of writing source code is displayed here.

Menu: The menu functions as any other Windows program menu would. It can be activated through the use of a mouse or by pressing the ALT key then using the keyboard arrow keys to navigate the menu options.



Figure 2 - The File Menu

New: This will erase any source code currently loaded and begin a new QB64 project. If the source code that is currently contained in the IDE has not been saved you will be given the option to save it before it is erased.

Open: This option opens a QB64 project previously saved. QB64 projects are typically .BAS files but the editor will open any standard ASCII text file for editing if you wish.

Save: This will save the current source code contained in the IDE to a project file. Typically this will be a .BAS file but you can rename the source file to anything you wish.

Save As: This will allow you to save the current source code as a project file with a different name.

Exit: This will leave the QB64 IDE. If the source code currently contained in the IDE has not been saved you will be given the option to save it before the IDE exits.



Figure 3 - The Edit Menu

Undo/Redo: This will allow you to undo or redo changes you made to your code. The QB64 IDE remembers all changes made to your source code so repeatedly pressing CTRL-Z will continue to undo changes all the way back to the beginning if you like.

Cut/Copy/Paste: These functions act exactly like any other Windows program you are familiar with.

Clear: This will delete any source code currently selected in the IDE.

Select All: All source will be selected for a Cut/Copy/Paste/Clear option.

Toggle Comment: This allows the programmer a quick method of commenting code out for debugging. When code is commented the QB64 compiler ignores it. We'll discuss commenting code in more detail later in the course.

Add Comment/Remove Comment: Allows the programmer to either comment or uncomment a single line of code.

Increase Indent/Decrease Indent: Source code is indented to identify quickly where command structure begins and ends, such as a looping construct. The default indent amount in the QB64 IDE is four spaces.

New Sub/New Function: Options for starting a new subroutine or function within the source code. More on that later in the course.



Figure 4 - The View Menu

Subs: A new window with a listing of all subroutines and functions will be displayed allowing the programming to quickly move from one area of the source code to another.

Line Numbers -> Hide Line Numbers: The IDE by default will display line numbers to the left of the cursor. This option will hide that functionality if you prefer. (not recommended)

Line Numbers -> Background Color: This allows the programmer to change the background color of the vertical line number strip to the left of the cursor.

Line Numbers -> Show Separator: This will add/remove the vertical bar just to the right of the line numbers. (not recommended)

Compiler Warnings: This will display a listing of any compiler information or warnings that the programmer needs to be aware of.



Figure 5 - The Search Menu

Find: This option will bring up a window that the programmer can type a search term into. The IDE will find the first instance of that search term.

Repeat Last Find: Once the Find option has been used using this option will find the next occurrence of the same search term.

Change: This option will allow the programmer to change text within the source code. More on that later.

Clear Search History: Clears the history of all previous searches performed.

Enable Quick Navigation: Allows the programmer to use the back arrow key to cycle through previous searches quickly.

Add/Remove Bookmark: Allows the programmer to add or remove a bookmark to/from the source code aiding in quick navigation.

Next Bookmark: Moves the cursor to the next bookmark within the source code.

Previous Bookmark: Moves the cursor to the previous bookmark within the source code.

Go To Line: Allows the programmer to quickly jump to a particular line of code.



Figure 6 - The Run Menu

Start: This option compiles and then executes the source code currently contained in the IDE.

Modify Command$: Allows the programmer to change the command line options passed to the program at execution time. More on that later.

Output EXE to Source Folder: When this option is checked, QB64 will create the executable file in the same folder as the source code is saved. When unchecked, the executable will be saved to QB64's folder.


Make EXE only: The source code contained in the IDE is compiled to a stand-alone EXE executable file.



Figure 7 - The Options Menu

The Options menu items are used to change the look and feel of the IDE to suit the programmer's preferences. We'll discuss these a bit further in this task below when customizing some of the options for this course.


Figure 8 - The Help Menu

View: Brings up the help window that utilizes the bottom half of the IDE screen.

Contents Page: This option brings up the help contents page.

Keyword Index: An alphabetical index of all QB64 keywords are displayed.

ASCII Chart: An ASCII (American Standard Code for Information Interchange) chart is displayed allowing the programmer to select from the extended ASCII set.

Math: A simple calculation box is displayed allowing the programmer to insert the result into the source code.

Update Current/All Pages: The help files are updated to the latest available on the QB64 web site.

About: Displays the version and build number of QB64 in use. When asking for assistance in the QB64 forums you may be asked for the version of QB64 you are currently using. This is where you go to get that information.


Customizing the IDE

By default the IDE screen is much too small to work in. The reason for this is that QB64 is a direct descendant of Microsoft's QuickBasic programming language. The default look of the QB64 IDE tries to mimic the QuickBasic 4.5 IDE as much as possible for those familiar with QuickBasic 4.5 to feel at home. For this course however we're going to need a larger IDE window to work in.


Figure 9 - The Options -> Display Screen

Choose Options in the menu and then choose Display in the drop-down menu. You will be presented with a screen as shown in Figure 9 above. These options allow the programmer to change the overall size of the IDE window. For this course the code will be presented as it would be seen in an IDE window of 120 characters wide by 40 lines high. Change the width value of 80 to 120 and the height value of 25 to 40 and then click OK. Of course you can make these numbers larger if you like to use more of your screen. My personal preference on my 1920x1080 screen is 140 characters wide by 50 lines high.


Figure 10 - Dark Blue Scheme

Also within this course the code will be color coded as if the IDE has been set to use the Dark Blue scheme. Choose Options in the menu and then choose IDE Colors in the drop down menu. You will see a screen appear as seen in Figure 10 above. Click on the right triangle next to the word Scheme until you see Dark Blue in the text box. Click on OK once you have done that. You do not have to choose this color scheme. If you prefer another go ahead and choose that one. Just keep in mind the color coding in the course will match what is seen using the Dark Blue color scheme.


Figure 11 - The IDE set for 120x40 Utilizing the Dark Blue Scheme