| Home | Why Omnibasic | Features | FAQ | Examples |
|---|---|---|---|---|
| Reviews | Keyword/Syntax | On-Line Manual | Download Manual | ScreenShots |
Writing and Using Programs
OmniBasic was designed to be easy to use and yet have tremendous power available to the programmer. We will start off in the ‘Easy to Use’ mode. The IDE (Integrated Development Environment) is a tool that allows the programmer to quickly and easily layout the appearance of the program and then fill in the details for the body of the program. The Editor in the IDE has two modes of operation depending upon if the programmer is creating a graphical program using the graphical layout features of the IDE or if the programmer is using the console or graphical scripting mode of programming. If the programmer is using the graphical mode then they will use the four program modules to develop the program. After laying out a display using the form window, the programmer can then fill in the details of the program. In this example we will continue to use the atest.obp program example that was shown in the Using the Compiler section.

Our example consists of one button and one textfield. As you drop objects onto the form, you are automatically building the OmniBasic code required to generate these objects. If you look in the Edit Window under the Construct Module, you will see the code that this form has generated.
|
The Form shown above generated the code shown at the right. The Form is called OBMain and the code in the Construct Module is the OmniBasic representation of what is displayed upon the form. In the Edit window we also have the Button called Button1 and the Text Field called TextField1. Any object that you place on the form is captured and converted into OmniBasic automatically. The programmer can also manually construct objects if needed. The format would be the same but the programmer would construct in Initialize, Function or Event Module. In a larger program the programmer can do the graphical layouts and compile them then take the resultant OmniBasic ‘bw’ files and drop them into a different project. However, constructed objects that are not placed upon the form using the IDE to physically place them will not be able to be displayed by the IDE. When using the IDE in the graphical development mode it stores the construction form and the program in the ‘obp’ format. When you compile the program it will generate the ‘bw’ format as well as the ‘exe’ file. The ‘atest.obp’ program is only readable to the IDE as a graphical development program. After compiling you will also have the ‘atest.bw’ program, which is a text file of the full OmniBasic code that was generated including the constructed information in the Construct Module. The final file created is the ‘atest.exe’ program. It is the executable program that you will actually run on the computer. |
![]() |
|
Our project will place “Hello World 1” through “Hello World 10” into the TextField1 object when we click on Button1. So we will Initialize our B variable in the Initialize Module.
In this simple example, we will not need any functions or subroutines so our Function Module will be empty. Now when we click on Button1, we want to cause the message in the TextField1 to increment from 1 to 10. This will be accomplished by using a click event in the Event Module.
When someone clicks the Button1, the above code executes. The TextField1 text will be updated by the value in the B string and the string value of the integer A. All text properties require that the data placed in it or taken out of it is a string variable or equivalent. The next line will increment the value in the A variable and then the next three lines are an IF statement test of the value of the A variable. If A is incremented to a value greater than 11, the program ends. We use 11 because we are incrementing after displaying the number. The value of A at the end of this event is always one higher than what is displayed in the TextField1.Text If you want to just write OmniBasic using your own favorite editor, that can be done as well. Once you have written your code and saved it as an ASCII Text file format with a .bw suffix (if it is a graphical program) or a .b suffix (if it is a console application). You can use the command line or the DOS prompt to invoke the OmniBasic Compiler. See Chapter 5 on how this is done. When creating Graphical Programs, if the program does not perform as expected, you can add message boxes to the program to stop the program and display one or more variables. Be aware that message boxes and turning objects invisible can not take place in the Declaration Module or the Initialize Module. You can also add Textfields to your program and print information into them to monitor issues in your program. When creating Console Programs, if the program does not perform as expected, it is sometimes useful to insert PRINT statements in various points in the program to check its progress. If there are errors in your program that violate some rule or syntax of the compiler, an English language indication of that error is reported. If there are any errors at all, the compiler will stop and not create an executable. The OmniBasic compiler reports errors in an English language format without any cryptic error codes. |
Home || Why Omnibasic || Features || FAQ || Examples
Reviews || Links || Privacy Statement || Top of Page
Innomation Systems, Inc.
117 Morrison Ave. Morrison, MO 65061 (573) 294-6130
OmniBasic is a
trademark of Innomation Systems, Inc., other trademarks are the property of their
respective owners.
Innomation Systems, Inc. reserves the right to change prices and specifications without prior notice.
Copyright © 2000, 2001, 2002 Innomation Systems, Inc.