Technical Issues - BASIC Tutorial II - Advanced BASICThis page covers more
advanced topics.
When compared
with VBA, FilmStar/Scantraq BASIC dialogs are more difficult to implement. It is
possible, however, to modify dialogs and implement interactive dialogs
containing dynamically updated fields.
The inclusion of an optional field (i.e. .DlgFunc) in the Begin Dialog statement triggers a dialog function with the same name. Six actions (Case 1-6) are possible, but we only need to bold the fonts during initialization, so only Case 1 is required.
Care must be taken with font substitutions since forms design is based on MS Sans Serif 8. The second modification, Fnum32Ang.bas, shows how to update field values within a dialog. Changing the cone angle changes the f-number and vice-versa. Here we make use of Action = 3 (text box change). Case 3
' Text box change Another option is to borrow an Excel form. This is not terribly difficult and is an excellent alternative if Excel is available, as it usually is. We have made use of this in setting up QA procedures for the aerospace industry. FTG Software has frequently emphasized the benefits of Microsoft Excel. In the screen below (Calculate in Excel.bas) we see how Excel VBA methods are referenced, just as if Excel had been built into FilmStar.
The converse situation is illustrated in Run-DESIGN.xls. In some cases the Design1.exe reference is missing or incorrect. Problems are usually solved by simply deleting and re-adding the reference. Should that fail please visit FilmStar Class References.
DESIGN objects are exposed to Excel, just as if FilmStar had been built into Excel. Whether FilmStar or Excel should 'run the show' depends on particular circumstances.
FilmStar BASIC is much enhanced through integration with other FilmStar Development Modules: FSPlot, Report Generator, and Workbook. Consider the following simple example:
In automation it seems useful to have (as appropriate) a single command center, that is one file setting up the entire procedure. We might want the Report Template to be within BASIC code. In the following we make use of the BasExec function to store the time and date in BasText(0). For more about this technique click here. Copy the following BASIC program and try it.
Since setting up a Report Template via BASIC would be tedious, the Report Generator can automatically generate BASIC code from the template. Click File.. Create BASIC Code. This is not the only BASIC code generator in FilmStar. There are two more in FSPlot: Annotations and Graph Details. FilmStar BASIC includes numerous FSPlot commands as in BandWidthPlot.bas. Graph annotations are initially added by the clicking on the graph and manually adding lines and text with the Annotator. The next step is to copy the resulting code to the clipboard via Setup.. Annotations.. Create BASIC Code.
Numbers are then replaced by calculated quantities. For example vline 1640.001 is replaced by "vline " & tStr(100*tm) where tm is the maximum transmittance calculated in Sub Bandmax. While this is somewhat tedious it is far easier than creating annotations without the Annotator.
Note that the graph shadow is dark green while the border is light green to match the page color. These are nonstandard FSPlot colors implemented by setting custom Bitmap/Gradient values in Setup.. Graph Details <Ctrl+H>. When publishing graphs it is important to exactly reproduce appearance settings including colors, fonts and graph size. This FSPlot task is accomplished by clicking File.. Create BASIC Code.
Sample code for setting up FSPlot for different graph types can be found in PlotConfig.bas. The Interactor connects to FilmStar BASIC via Automation options. A good example is the ability to update an Admittance Smith Chart. Some advanced users have taken advantage of Workbook's ability to run BASIC programs during optimization. This is accomplished by including BasRun or BasExec in Workbook macros. Links to diverse topics involving FilmStar BASIC:
|
Copyright © 2023 FTG Software Associates
Last updated on
January 31, 2023