| Home | Why Omnibasic | Features | FAQ | Examples |
|---|---|---|---|---|
| Reviews | Keyword/Syntax | On-Line Manual | Download Manual | ScreenShots |
Chapter 11Graphical StatementsConstructThe CONSTRUCT statement is used to construct visual objects as well as non-visual objects such as timers. The IDE automatically constructs objects that are placed onto the form. The result of this may be viewed in the Construct Module of the Text Editor. While working in the Graphical Project Mode, manually generated objects and forms need to be created in the Event module or the Function Module. In the simplest case the assumption is made that the object being constructed will belong to the main window (OBMain). To construct a BUTTON on OBMain, the following code is all that is required:
Some objects require a “holder”. An example would be a group of Radio Buttons. These normally reside in a Frame. First we construct the Frame and then we construct an array of 3 Radio Buttons in the Frame. Example:
Also notice that the array size is specified inside parentheses immediately following the object name. There are several variations on Construct based on the type object being constructed. For ICONS and Images:
For FONTS:
NOTE: There are other ways of dealing with fonts in the Font Property Section. For secondary Forms:
In the last example, the Placement argument is optional. The additional types of placement are: Default – Place at upper left corner. BEGINWAITCURSORThis statement is used to set the cursor to a wait cursor. This is used when it is desired to provide a wait indication to the user. There are no arguments to this statement. ENDWAITCURSORThis statement is used to set the cursor back to normal after having displayed a wait cursor. There are no arguments to this statement. DESTROYThe DESTROY statement is used to remove an object which was previously CONSTRUCTED. Example:
Dialog Boxes Dialog boxes are pre-built modal windows that are used to display a message, prompt the user or allow a particular type of selection to be made. The types of dialogs with accompanying syntax are as follows: Message Box
The MessageBoxTypes are: INFO (or INFORMATION) The AnswerOptions are:
The answer codes returned to OBDialogCode are:
Note: If the AnswerOption is OK, the last argument may be omitted. This is to say that if the AnswerOption is omitted, OK is assumed as the AnswerOption. Some examples follow:
Input Dialog
If the OK button is clicked, OBDialogFlag will be true and OBDialogText will contain the text enter by the user. If the Cancel button is clicked, OBDialogFlag will be false. An example follows:
This Dialog Box was created in the DialogText Program. This program is unique in that it shows graphics, control and data entry without having any variables. So this program only has a Form and a Button constructed and a click event off of that button.
Editor Construct Module:
Editor Event Module Color Dialog
The ColorCode is an integer representing the RGB numeric value that will be displayed when the color dialog pops up. The user uses sliders, input boxes, or check buttons to select a color. If the user clicks on the Accept button, OBDialogFlag will be true with the color code or RGB value in OBDialogCode. If the user clicks on the Cancel button, OBDialogFlag will be false. An example:
File Dialog
The Types are: OPEN The Path specifies a starting point for the file specification. It may be entered as a null string (“”) in which case the current directory or folder is the default. FileFilter is a string describing the types of files to be displayed on the combobox within the file dialog and subsequently in the file display section. FileFilterNumber is the number of the FileFilter to be set as the default filter. An example:
This will cause a file dialog with a title of “SaveAs” and a default to the entered directory (folder) including file type description to appear. All “obp” files will be displayed.
This will cause a file dialog with a title of “Open”, a combobox containing “*.zip”, and “*.exe” with *.zip displayed (preselected).
This one is the same as the previous one except that descriptive titles precede the FileFilters. Also the second entry will be the displayed default. If the user selects (or enters) a file and clicks on the Accept button, OBDialogText will contain the full path to that file and OBDialogFlag will be true. OBDialogCode will contain an integer indicating which filter was selected. If the user clicks on the Cancel button, OBDialogFlag will be false. Font DialogAn example:
This will cause the font dialog to appear. If the user selects a font and clicks on the Accept button, a set of font variables comprising the font descriptor will be set according to the user’s choice. OBDialogFlag will be set to true. The variables are:
If the user clicks on the Cancel button, OBDialogFlag will be set to false. When using the Font Dialog, we recommend sticking with the Western Character Set. Some of the more exotic choices on some of the fonts can lead to less than desirable results. The two primary adjustments to the fonts are type of font and the size of the font. Print DialogAn example:
This will cause the print dialog to appear. If the user selects a printer and clicks on the Accept button, OBDialogFlag will be set to true, OBDialogText will contain the full printer name as well as the printer ID (or path) inside angle brackets (<>). OBPrinterID will contain the parsed ID or path. This ID is used to open the selected printer for use. Typical code example:
If one of your printers is on an NT server and your printer name has a back slash in it, it may not appear on the list of available printers, at least in the 2.10 release version of the software. If this is the case then you can still set up a way to that printer, using a direct dialog box and then using the information you type into the Dialog Box to direct the print output. In this example we are reading the printer path out of a dialog box:
If the user clicks on the Cancel button, OBDialogFlag will be set to false. Search Dialog
The Search Dialog is a tool for gathering the information from the user on what to search for and how to search for it. When the program invokes the Search Dialog Box, The user will fill in the information and then the information will be available to the program using the special variables. In the following example we will invoke the Search Dialog Box on a Button1.click event. If the user presses search then the OBDialogFlag will be True, if the user presses Cancel then it will be False. If OBDialogFlag is True then the Text in the “Search for:” Window will be available in OBDialogText. The search modes “Exact, Ignore Case, Expression and Backward are available in the OBDialogCode. The OBDialogCode is a bit flag word. The first bit is used for the Backward checkbox and the backward arrow. The third bit is used for the Ignore Case flag and the fourth bit is used for the Expression Flag. Here is a Table:
The programmer can set a default OBDialogCode when the SearchDialog is invoked as the first argument. The second argument is a preset for the “Search for:” string. Here is an example:
Replace Dialog
The Replace Dialog is similar to the Search Dialog except it will return the text from the “Replace with:” window in the OBDialogText2 special string variable. The text strings for “Search for:” and “Replace with:” can be preset. In the following example, the “nothing” and “something” in the above display are preset.
|
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.