Gambas IDE Components
The Project Explorer is the main Gambas window. It show you a TreeView of the types of files found within your project (i.e., class files, forms, modules, and other types of files such as data and picture or icon files) and the Project Explorer allows you to perform most Gambas project management operations, such as opening and saving projects, building executables, running your program or debugging it, showing or hiding various Gambas dialogs, etc. From the TreeView in the Project Explorer, you will see the items listed as follows:
Classes
Forms
Modules
Data
Classes lists the class files you've created for your project. Classes are basically templates that can be used to make objects out of at runtime, with code to define properties, methods and event handlers for each object you create.
Forms lists the various forms you create for your project. Forms are the windows the user actually interacts with.
Modules display the modules you've written for your project. Modules are simply sets of subroutines and functions to be used anywhere in your program. Unlike classes, you can't make objects out of them at runtime and they have no event handlers.
Data lists the other files in your project. These can include any other kind of file used to build your project, such as graphic files, icons, bitmaps, text or HTML files, and even media files. At the bottom of the Project Explorer you will find the Status Bar which is used to indicate what Gambas is currently doing.
When you start to develop a project in Gambas, you will usually want to begin with a main form. The main form is where the program startup and initialization will occur and it is usually the first thing your user will see when they execute (or run) the application you have built. This is the form you will add controls to and specify what actions are to be taken when the user interacts with those controls. Such interaction between the user and the GUI is referred to as events. The controls are found in the ToolBox window. You can change the appearance and behavior of the controls by setting the properties for each control. Properties can be seen in the properties window.
Now, lets take a look at the menus and buttons found at the top of the Project Explorer. The menus (see Figures 9 through 12 below) control all the main Gambas management tasks. The File menu will allow you to open a project, save a project, create a new project, open some Gambas example projects, or quit using Gambas. The Project Menu is where program compilation occurs. You can also create the program executable, make a source archive, or create an installation package. This menu offers you the option of translating your program into another language. Finally, you can set Gambas IDE properties from this menu.
The View menu will allow you to bring up the properties window or the ToolBox window. You can open a console or use the Icon Editor to create program icons. The Hierarchy option will open a window and show you your project's class hierarchy. Finally, from this menu, you can close all of the windows that are currently open in the IDE. The ToolBar buttons (see Figure 13 below) provide single-click access to the most common menu items. Hovering your mouse cursor over one of the buttons will display a ToolTip that will tell you what menu action that particular button will perform.
Figure 13 below shows you the File menu and ToolBar. From the Project Explorer TreeView you can double-click on a form and it will pop up for you to edit. Editing forms is simply a matter of selecting what type of control you'd like to place on the form and then using the mouse to resize (draw) it on your form.
Right clicking on the form or any of its children (controls) will show you a pop-up menu that will allow you to perform operations on the control, edit its properties or delete it. The currently selected control is indicated by four black squares called handles. Clicking on a handle and using the mouse to drag the control where you want it will allow you to move or resize the control. Double-clicking on a control will bring up the code editor window and display any existing event handler for the control or display a default event handler if there have been none specified.
The Gambas Code Editor enables you to write code to handle events for the controls you've placed on your form. In the ToolBox window, the Selection Tool is the only item in the ToolBox that isn't actually a control. The Selection Tool simply gives you control of the default mouse pointer. You use this pointer to select controls and perform positioning and resizing operations on forms and their associated controls.
From the Project Explorer File Menu, choose the Quit option and save your project. When we reopen it, all your work will be saved. In the next section, we will begin to cover the essentials you need to understand in order to program with Gambas. We will come back to this project to develop a program that uses the GUI after we learn a bit more about the Gambas coding environment, the primary language concepts that are required to use Gambas, and some basics about data-types and variables. That is all covered in the next section and constitutes the remainder of this introduction to Gambas programming. For now, take a short break and we will continue when you come back.
|