Graphics QuickScreen
Graphics QuickScreen
SOFTWARE, INC.
Graphics QuickScreen
Version 1.10
Introduction
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Thanks! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Registration & Upgrades . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Graphics QuickScreen Overview . . . . . . . . . . . . . . . . . . . . . 1-3
Users of QuickScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Graphics Mode Screen Designer . . . . . . . . . . . . . . . . . . . . 1-3
BASIC Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Displaying Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Data Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Additional Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Compiler Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Using This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Notational Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Installation Instructions
Installation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Setting The DOS Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
The Readme File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Major Files Of Graphics QuickScreen . . . . . . . . . . . . . . . . . . 2-4
Copying And Backing Up . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
QuickStart
Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Running The Demos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Paintbrush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4- 7
Flood Fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Zoom Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Recolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Copy/Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-10
Print Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... 4-11
Push Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-12
Drawing Aids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Controlling The Mouse Cursor . . . . . . . . . . . . . . . . . . . . .4-13
Grid Snap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
Painting Fields . . . . . . . . . . . . . . . . . . . . . . . . . . ..... .4-15
The Pulldown Menu System . . . . . . . . . . . . . . . . . . . . . . . .4-16
Menu System Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17
Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... .4-18
Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-19
General Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-20
Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-20
Text Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Multi-Line Text Box . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
List Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Check Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Option Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Command Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-21
Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-21
Single and Multi-line Text Boxes . . . . . . . . . . . . . . . . . . .4-21
List Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-22
Check Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-22
Option Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-22
Command Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-22
Menu Item Information . . . . . . . . . . . . . . . . . . . . . . . . . . .4-22
File Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22
New Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-22
Open... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-23.
Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-24
Save As . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-26
Save Paste Buffer... . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-26
Load Paste Buffer... . . . . . . . . . . . . . . . . . . . . . . . . . . .4-27
Print Screen... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-27
DOS Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-28
Exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-28
Edit Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-28
Creating Screens
Creating Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
InitMouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-45
KeyDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-46
LibGetFldDefG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-47
LibGetGMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-48
LibNumFieldsG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-49
LibShowForm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-50
ListBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... 7-53
Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-55
Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-56
MultMonitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-57
NumFieldsG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-58
Num2Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-59
OpenFiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-60
OpenPCXFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-61
PositionPCXVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-62
PrintArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...... 7-63
QEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-64
SaveField . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-71
SaveRec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-72
Scrollln . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-73
SetPaletteEGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-76
SetPalTripleVGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-77
SetUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-78
ShowCursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... 7-79
Show Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-80
Tokenize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... 7-82
UnPackBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-83
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-84
WholeWordln . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-85
Appendix A
The GPDat%O Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
Glossary
Tutorial
1
■
Graphica Quick.screen
INTRODUCTION
Introduction
I
Thanks!
Thank you for purchasing Graphics QuickScreen from Crescent Software!
We have put every effort into making this the finest and most powerful
Graphic Screen building product available. We sincerely hope that you
love it. If you have a comment, a complaint, or perhaps a suggestion for
another product you would like to see, please let us know. We want to be
your favorite software company.
Also, please mark the product serial number on your disk labels. License
agreements and registration forms have an irritating way of becoming lost.
Writing the serial number on the diskette will keep it handy.
You may also want to note the version number in a convenient location,
since it is stored directly on the distribution disk in the volume label. If
you ever have occasion to call us for assistance, we will probably need to
know which version you are using. To determine the version number for
any Crescent Software product simply display a directory of the original
disk. The first thing that appears is similar to:
Volume in drive A is GQS 1.10
We are constantly improving all of our products, so you may want to call
periodically to ask for the current version number. Major upgrades are
always announced, however minor fixes or additions generally are not. If
you are having any problems at all, even if you are sure it is not with our
software, please call us. As a registered user of one of our products, we
provide support for all versions of QuickBASIC and BASIC PDS and can
often provide better assistance than Microsoft.
Acknowledgments
Graphics QuickScreen was written by Phil Cramer using Microsoft BASIC
PDS 7. I and library routines from Crescent's QuickPak Professional and
Graphics Workshop libraries.
I would like to thank Don Malin for his assistance and advice in developing
Graphics QuickScreen. Don wrote the original QuickScreen text mode
screen designer that inspired this program. In addition, several of Don's
QuickScreen modules were adapted for this graphics version, including
the main EditFormG subroutine.
I would also like to thank Brian Giedt for creating many of the graphic
assembler routines that make Graphics QuickScreen possible. Several of
these routines are derived from Crescent's Graphics Workshop library.
Graphics Workshop is highly recommended to anyone interested in further
enhancing their graphic applications beyond what BASIC and Graphics
QuickScreen alone can accomplish.
- Phil Cramer
I
Graphics QuickScreen Overview
Graphics QuickScreen is both an EGA/VGA graphic screen design tool
and data entry forms library. The screen design component lets you create
your own graphic screens-called display-only screens-using a sophisti-
cated paint program. Screens are saved in the popular .PCX format and
can easily be transported to and from other paint programs. Scanned
images saved in .PCX format can also be incorporated into your screens.
These screens can be displayed from your BASIC programs at any time.
With Graphics QuickScreen, you can also create screens to be used as data
entry forms which we refer to as data entry screens or forms. This
powerful feature lets you to quickly design screens which gather informa-
tion on a field-by-field basis from a user. Of course, your own BASIC
program can control the form and read the values it contains.
Forms are extremely flexible, and data from them can be saved to disk
either as simple random access files, or using data base management
utilities such as the BASIC PDS ISAM System. Graphics QuickScreen is
also fully compatible with AJS Publishing's db/LIB product and Novell's
Btrieve library.
Users of QuickScreen
If you are already using Crescent's QuickScreen, you will find the
conversion to Graphics QuickScreen to be relatively simple. The screen
painting portion of the screen designer is of course different from
QuickScreen's text mode counterpart, but the field definition process is
virtually identical. In addition, the subroutines that handle your forms use
the same or similar calling syntax. Many of the subroutines also have
similar names to their QuickScreen counterparts but with the letter G (for
Graphics) appended to distinguish between them.
Box, radius box, circle, ellipse, arc, polygon and line drawing.
Tile palette containing 127 additional dithered colors and 28 tiled pat-
terns.
Block operations such as Copy, Move, and Paste. Any block can be
easily centered horizontally or vertically.
Scaleable fonts for captions and titles can be displayed at any angle.
, Palette editor to let you easily assign any of the EGA's 64 colors or
the VGA's 256,000 colors to the available 16 color palette.
Data entry screens are created with the help of 23 pre-defined.field types,
such as a zip code and dollar value. Additionally, fields can be further
customized:
Fields can be protected from being changed; they can also be in-
dexed and formatted in any way.
Fields can support range checks and field calculations based on sup-
plied formulas.
, A special data-entry test mode lets you try out the current form
during editing. Forms can be generated in two formats.
BASIC Modules
Introduction
■
Graphics QuickScreen's BASIC modules allow you to manage both
display-only and data-entry screens.
Displaying Screens
To display screens from BASIC you may use a variety of methods:
Data Entry
Managing data entry screens from BASIC is one of the more appealing
features of Graphics QuickScreen. The supplied BASIC modules let you
do the following:
Polling lets you take special actions based on the user's activity
without having to modify Graphics QuickScreen's data entry routines.
Additional Utilities
Graphics QuickScreen is shipped with two additional utilities you are sure
to find useful. The first is a TSR called PCXCAP, a utility which is used
Compatibility
System
Graphics QuickScrcen requires an EGA or VGA color monitor and will
run on IBM XT, AT, PS/I- and PS/2-class machines and compatibles that
contain at least 2561 of video memory. At least one megabyte of expanded
memory is recommended but not required. DOS 2.0 or above is needed
as well as a Microsoft compatible mouse.
Compiler Versions
Graphics QuickScreen is available for users of Microsoft compiled BASIC
only: QuickBASIC version 4.x; BASCOM, version 6.x; and the BASIC
Professional Development System, version 7. x. If you own an earlier
version of BASIC we suggest that you contact Microsoft for an upgrade.
We will be happy to assist you in making a decision to upgrade.
Intended Audience
This manual is designed for users familiar with QuickBASIC and with the
concepts of using libraries and compiling to create stand-alone programs.
We have not attempted to unnecessarily duplicate information which is
QuickBASIC-related and appears in the QuickBASIC documentation, but
do explain necessary steps for using this product effectively.
Notational Conventions
Introduction
I
We have used some variations in type style mainly so that the manual is
clear and more enjoyable to read. The purpose for most type styles is
clear (i.e., for topic headings, computer text, and so forth.), however there
are some uses which may require further explanation:
Notice also the use of vertical ellipses to convey that more program
instructions may follow and the use of BASIC's single-quote REM symbol
(') to present comments.
, Pulldown commands are printed in boldface for clarity using this syn-
tax:
For example, "(File) New Screen ... " refers to the File menu and the New
Screen ... pulldown command within that menu. When a menu is dis-
cussed alone, the menu name, such as File, is in boldface.
LINK PROGNAME.OBJ,,BQLB45 /Q
Notice that not only is "45" italicized, but also the program name, which
is specified by the user, is italicized. Italics in the main text often represent
terms which are defined in the glossary.
Keys on the keyboard are represented as the key name in bold face.
Key names are taken from the standard IBM extended keyboard.
Certain keys are mentioned in terms of general function. For ex-
ample, the direction keys typically include the up-, down-, left-, and
right-arrow keys, and sometimes the PgDn and PgUp keys as well.
When we need to refer to all of these keys as a group, we will refer
to them as direction keys.
Technical Support
If you require technical support for Graphics QuickScreen, you will need
your serial number before calling us at (203) 438-5300, between 9:00 a.m.
and 5:00 p.m. EST, Monday through Friday. Please gather as much detail
as possible about the problem before you call. Be prepared to provide the
Graphics QuickScreen version number as well as the BASIC version
number. We can assist you best when you are able to describe the precise
nature of any difficulties.
2
■
Graphics QuickScrccn Installation
INSTALLATION INSTRUCTIONS
Installation
Graphics QuickScreen is distributed using the popular and efficient .ZIP
I
compression format. To help simplify the process of extracting specific
files from the archive, we've created a front-end installation program
named INSTALL. Upon starting, this program shows the number of bytes
the extracted files will occupy, and even allows you to select those files
you wish to extract.
If you start INSTALL from a drive and/or directory different from the one
containing the INSTALL.EXE program, the current drive and directory
is used as the installation destination.
When the program starts, it displays its main screen (see Figure 1), and
also the name of the product .ZIP files. The second line of the screen
displays the available function-key commands. Below this is a field where
the installation destination drive and path may be specified. To the right
of this is a display field where the amount of free disk space is displayed
for the specified target drive. The bottom-left portion of the screen
contains a bar menu where the available .ZIP files are displayed along
with the disk space required for installation. The bottom line of the menu
displays the total disk space needed to install all selected files in the menu.
The bottom line of the screen displays comments about the currently-high-
lighted file.
I WMtidtwhm:mtii ■m
A •
•3M®flilffll\11t1iH
Files 11111 be installed In the Drive and Directory llsted below. tr the
••
specified Directory does not exist, It 111111 be created autOM.tlcally during
Installation. Press Ent.er or Tab to MJve to the f lie 111enu below.
1.iu,le%1J
File Required Space
J' GQS .ZIP 780,288
J' DEMOS .21P 557,056 Graphics Qu lckScrcen
J' GQSSUBS.ZIP 300,592
J' GQSLIBS.ZIP 113,3b0 Screen Des lgncr and ut 111 ties
Several function keys are operable from INSTALL. They are summarized
in Table 1.
The Destination Drive/Path field contains a default drive and path where
the selected files will be installed. We suggest that you use \GQS as the
destination directory. However, you can choose any valid DOS path name.
If you specify a path which does not exist, it will be created during
installation. If you change the drive letter, the amount of free space on
that drive is displayed to the right after moving from this field.
~ Function
F2 Info On Displays the contents (i.e., file names and sizes)
Zip File of the currently highlighted file. After viewing
or selecting individual files, you can press Esc
to go back to viewing the actual .ZIP files.
■
The Tub and Shift-Tab keys move the cursor between the Destination
Drive/Path field and the File Display box. Within the File display, the
Space Bar or Enter key will toggle a check mark (I/) on or off. You can
check entire .ZIP files or you can press F2 to check individual files within
ZIP files. If you are checking individual files, simply press Esc to go
back to the .ZIP file list. When you are finished, all checked files are
installed when F3 is pressed.
The number of bytes displayed to the right of each file name is the space
required on the destination drive to install that file. This number is the
uncompressed size of the file-rounded up to the nearest cluster.
After the Destination Drive/Path has been specified and files have been
selected, you can press F3 to begin installation. If the total expanded size
of all selected files exceeds the available disk space, you will be asked
whether to continue. You may answer "Y" for Yes if you are sure there
is enough space on the target drive. This would be the case if you are
installing a newer version of Graphics QuickScreen in the same directory
as the one that already exists.
If you are installing to an existing directory you will be asked if you wish
to be prompted before existing files are overwritten. We suggest answer-
ing Yes if you are not sure about overwriting certain files.
Once all selected files have been installed, the program displays a message
indicating a successful installation.
■
SET PATH=D:\QB
If your system uses multiple drive letters for several disk partitions, we
suggest including the drive letter of each directory in your PATH statement.
Doing this ensures that the directory can be properly located.
Some users will need to specify several paths so that QB and BC are
properly found. In the Microsoft BASIC Professional Development
System, the QBX executable and BC are in separate subdirectories by
default: \BC7\BIN and \BC7\BINB, respectively. In this case, you would
need to specify both paths:
SET PATH=D:\BC7\BIN;D:\BC7\BINB
Notice that multiple paths are separated by semicolons. This way, many
drive/directory combinations can be searched:
SET PATH=D:\QB;C:\DOS;C:\WINDOWS;E:\GAMES
To see the current 11\TH setting, simply type PATH at the DOS prompt.
After logging onto your Graphics QuickScreen directory, simply enter the
following DOS command to view it. (Ctrl-S pauses the output until a key
is pressed):
TYPE README
■
File Name Description
■
GFORMS.QLB Graphics QuickScreen quick library file for
QuickBASIC 4.x or BASIC 6.0
File names that start with the letters NO are used to exclude support for
certain features, and serve a similar function as the stub files that come
with some versions of BASIC. Stub files replace selected modules with
others having the same name but have reduced functionality. This lets you
reduce the size of your programs when certain features (such as calculated
fields) are not needed.
QUICK STARf
■
If you are familiar with QuickBASIC and add-on libraries, you can get
started quickly by running the Graphics QuickScreen demonstration
programs. These programs are liberally commented so you can easily see
how they work and how the Graphics QuickScreen routines are set up and
called.
• DEMOANYG.BAS
• DEMOALLG.BAS
• DEMOCUSG.BAS
• DEMOINVG.BAS
This demonstration shows an invoice form and the special features which
make Graphics QuickScreen so powerful, such as the use of multiple-
choice, calculated, and note fields. Examples of advanced polling are
demonstrated which report the user's activity on the form and make certain
fields change their characteristics based on user-defined options.
• DEMOPAGG.BAS
■
This program also demonstrates loading screen and form files from a
custom .GSL library.
• DEMODBLG.BAS
These Quick Library files contain the various assembly language sub-
routines used by the Graphics QuickScreen modules. Therefore, they are
needed to run any of the supplied programs.
If you need to use additional routines from other libraries to your program,
you can use the MAKEQLB utility that comes with Graphics QuickScreen
to create them.
4. Once the program has been loaded, you can press Shift-FS to
run it.
Once the program begins you should be able to use Graphics QuickScreen's
intuitive interface right away. If you have a mouse, it will be recognized
and used automatically. Also, a help screen showing the action of various
keys is available by pressing Fl.
During drawing and editing, the right mouse button and the Esc key both
work as toggles to turn the Drawing Palette on and off. The Drawing
Palette always pops-up beneath the graphic cursor and it remains active
until a drawing tool has been selected or the right mouse button is clicked.
Once a tool has been selected, you can continue to draw or edit using the
left mouse button. To cancel the current tool, click the right mouse button
to return to the Drawing Palette.
Selecting a Color
To select a drawing color from the Drawing Palette, place the cursor over
the desired color and click the left mouse button. The selected color will
appear in the lower right corner of the Drawing Palette. The color will
I . also appear in the Status Box if it is active. In addition, you may select a
color by pressing its corresponding numeric key. Numeric keys cor-
respond to the standard color assignments as used by BASIC where O =
black, 1 = blue, 2 = green, 3 = cyan, and so on. To access colors 10
through 15, hold down the Shift key as you press the numeric keys 0
through S.
Colors may be changed during any of the drawing operations, even in the
middle of a paint or sketching procedure by typing its assigned color
number. (Numeric color keys are not supported when typing text selected
from the T icon or from the (Draw) Print Text menu because they are
used to enter the actual numbers as text.)
The mouse cursor can also be controlled from the keyboard by using the
various cursor keys. The Enter and Esc keys perform the same function
as the left and right mouse buttons.
Any edits you make can be undone by pressing FlO. This will restore the
screen to its condition just before the last drawing tool or menu item was
selected.
Lines
-+ To draw a line:
2. Place the cursor where you want the line to start and click the left
mouse button.
■
3. Move the cursor to the desired end point and click the left mouse
button.
Line drawing will continue from the last endpoint until you click the right
mouse button. A single right click lets you start a new line and two clicks
returns you to the Drawing Palette.
Polar Mode allows you to draw lines a specified length and at a specified
angle.
3. Press the P key at any time during the line drawing procedure
and a dialog box will appear.
4. Enter the desired length (in pixels *) and the angle in degrees
separated by a comma and then click "OK". The length should
always be a positive value but degrees may be specified as any
positive or negative whole number.
5. Click the left mouse button to accept the line and to continue
drawing in polar mode. Clicking the right mouse button will undo
the line and return you back to conventional Iine drawing.
End coordinates that would place the line off-screen are not allowed. In
this case, a beep warning will sound and Graphics QuickScreen will revert
back to normal line drawing.
*Ona VGA monitor (640x480) where the aspect ratio is I: I (10 vertical
pixels appear the same length as 10 horizontal pixels) the length at any
angle will be consistent. When using an EGA monitor where the aspect
ratio is approximately . 73: I, 10 horizontal pixels do not represent the
CRESCENT SOFTWARE, INC. ■ 4-3
The Screen Designer Graphics Quick.Screen
Box
To draw a box:
[]]
I. Select the box icon from the Drawing Palette.
I 2. Place the cursor at any corner where you wish to start the box and
click the left mouse button.
3. Move the cursor until the box is the size desired and click the left
mouse button.
Radius Box
[[]
The procedure for drawing a radius box is the same as for normal box
drawing. The radius for the corners is measured in pixels and is set from
the System dialog box. If the box dimensions are less than two times the
radius of the arc, the radius is automatically reduced to fit the dimensions.
A very large radius therefore enables you to draw virtually any size oval
without readjustinr the radius.
Filled Box
[!]
The procedure for drawing a filled box is the same as for box drawing.
Also see the section Painting Fields for more information.
Arcs
To draw an arc:
2. Position the cursor at the center of the arc and click the left mouse
button.
3. Locate the starting point of the arc with the cursor and click the
left mouse button. A circle will appear defining the possible path
for the arc and an "X" will appear at the selected starting point for
the arc.
4. To define the end point for the arc, place the cursor such that the
"rubberband" radius intersects the circle at the desired end point,
and then click the left mouse button. This point can be anywhere
on the screen, even inside the circle. The circle and the "X" mark
will disappear and an arc will be drawn counterclockwise from the
starting point to the specified endpoint.
If you prefer to draw arcs clockwise from the starting point, press the A
key while in the arc drawing mode. The cursor will change color (from
white to yellow if on a black background) and a beep will sound to
acknowledge your selection. Arcs will then be drawn clockwise from the
starting point. Pressing A again will toggle back to counterclockwise
operation. Elliptical arcs are not directly supported but can be simulated
by using the Draw Polygon procedure.
I
Circle/Ellipse
To draw a circle or an ellipse:
2. Position the cursor at the center of the circle and click the left
mouse button.
3. Move the cursor until the circle is the size desired and press the
left mouse button. To ensure a true circle, drag the mouse just out
side of the circle before releasing the mouse button.
4. To draw an ellipse, hold the mouse button down and push or pull
the circle into an ellipse. The type of ellipse drawn will depend on
where the cursor is when you press the button. If pressed at
approximate! y I 2 o'clock or 6 o'clock you can draw a horizontal
ellipse. If you press at approximately 3 o'clock or 9 o'clock you
will draw a vertical ellipse. If you press at approximately I :30,
4:30, 7:30 or 10:30 then you will be able to draw either a vertical
ellipse or a horizontal ellipse, depending on the position of the cur-
sor as you drag it inside the encompassing circle. Release the
button to complete the ellipse.
Polygons
The polygon routine will draw a polygon with from 3 to 99 sides at virtually
any size and at any angle. You can also specify an aspect ratio to stretch
the polygon either vertically or horizontally. You can also limit the number
of sides of the polygon that are displayed.
Select the triangle icon from the Drawing Palette. A dialog box will appear
prompting you for the following information:
■
angle is O and corresponds to the 3 o'clock
position. Angles are then measured from this
point counterclockwise with 90 degrees being
vertical (12 o'clock), 180 being horizontal (9
o'clock), and so forth. The desired angle can
be any whole angle, positive or negative.
■ Example:
To draw a standard isosceles triangle with the base at true horizontal,
specify three sides and a starting angle of 90. A standard square can be
drawn by specifying four sides and a starting angle of 45 degrees or you
can draw a diamond by leaving the starting angle at 0.
Sketch
The Sketch routine lets you draw freehand images by dragging the mouse
or by using the various cursor keys.
■
To sketch lines using a mouse:
2a. Position the cursor where you want the line to begin and hold
down the left mouse button. As long as the button is down, a
continuous line will be drawn as you drag the mouse. Releasing
the button will complete the line.
2b. Position the cursor where you want the line to begin and press
Enter. Line drawing is controlled by pressing the various direction
keys. The mouse can still be used to control line drawing but it is
not necessary to hold down the left mouse button. Pressing Esc or
clicking the right mouse button will complete the line.
You can continue to sketch lines or click the right mouse button to return
to the Drawing Palette.
Paintbrush
The Paintbrush routine lets you paint lines of nearly any thickness by
dragging the mouse or by using the various cursor keys. The brush size
can be set from the System dialog box.
2a. Position the cursor where you want to begin painting. The
paintbrush is activated whenever the left mouse button is held
down.
2b. Position the cursor where you want to begin painting and press
Enter. The paintbrush is controlled by pressing the various direc-
tion keys. The mouse can still be used to position the paintbrush
but it is not necessary to hold down the mouse button. Pressing
Esc or clicking the right mouse button will stop the paint flow.
■
You can continue to paint or click the right mouse button to return to the
Drawing Palette.
Flood Fill
The Flood Fill routine allows you to quickly and easily paint entire regions
of any shape. The region being filled must be entirely surrounded by a
single color to contain the flood of paint. When you click on an area to
be filled, the routine first checks the color beneath the cursor and then
looks to the right to find the first occurrence of a different color. It assumes
that the second color it finds is the surrounding color and floods the entire
region surrounded by that color.
1. Select the paint bucket icon from the Drawing Palette. The cursor
will change from white to black.
2. Locate the cursor within the surrounding color and click the left
mouse button.
You may continue to flood fill regions or return to the Drawing Palette by
clicking the right mouse button.
Zoom Editor
The Zoom Editor allows you to zoom in on a region of the screen and
easily edit individual pixels. You may select any rectangular region of the
screen up to approximately l-112 square inches depending on the monitor
size and screen mode. The region will be identified with a surrounding
box and the enlarged portion will automatically display near the selected
region. The screen will be updated simultaneously to reflect any edits you
make.
■
region is too big to be enlarged, In that event, simply select a
smaller region.
You can undo any edits by pressing FlO while the zoom window is still
active.
Recolor
The Recolor option lets you change any color in a specified region to a
new color.
I. Select the color wheel icon from the Drawing Palette. A color
palette will appear replacing the Drawing Palette and the prompt
"Pick the color to change" is displayed.
3. Select the new color by clicking on it with the left mouse button.
The color palette will disappear and a drawing cursor will appear.
■
You may continue to recolor portions of the screen or you can return to
the color palette to select new colors to change by clicking the right mouse
button. One more right mouse click will return you to the Drawing Palette.
Copy/Move
The Copy/Move option allows you to copy or move any region of the
screen to memory (up to 64k) or to any place on the screen. The image
can also be saved to disk using the Save Paste Buf... " option from the
pull-down menu or later recalled by selecting the Paste option from the
Edit menu.
The Move option lets you grab an image and move it anywhere on the
screen leaving the background color* in its place. The Copy option lets
you make multiple copies of an image without deleting the original. The
default mode when selected from the Drawing Palette is Copy. You can
switch the default to Move by changing the setting on the System dialog
box. Copy and Move are also available separately from the Edit
pull-down menu. Regardless of what mode was used to capture a region,
the image will remain in the paste buffer even after loading a new screen
or until one of the following occur:
3. Locate the image where desired and click the left mouse button. If
Copy is selected, you can continue to make copies by clicking the
left mouse button. If Move is selected, a single left click will
complete the procedure.
■
The captured image is moved over the screen using XOR. As the image
is moved, you see a combination of the copied image and the underlying
background with colors inverted as they are XORed together. When
pasted, the image will return to its original colors. (XOR off). Checking
"XOR on" on the System dialog box under the Settings menu will instead
use XOR when pasting the image. This is particularly useful when the
background of the captured image is black. In this case, only the colored
portion of the captured image will be copied; the rest of the image remains
transparent. Unwanted color changes in the pasted image can be corrected
using the recolor command.
Print Text
This option lets you enter text using your computers internal font at
standard row and column coordinates. The text is printed without disturb-
ing the underlying screen.
-+ To print text:
1. Select the desired text color and click on the T icon from the Draw-
ing Palette. A blinking text cursor will appear.
2. Point the mouse cursor at the desired row and column and click the
left mouse button.
3. Type in the desired text. Text can be erased without affecting the
underlying screen using either the Spacebar or Backspace key as
long as you remain on the same line.
The following table lists the keys that can control the cursor while printing
text.
Action
I - Ctrl+ Left
Ctrl + Right
Home
End
PgUp
PgDn
20 spaces to the left
20 spaces to the right
Moves the cursor to the first column
Moves the cursor to the last column
Moves the cursor to the top row of the screen
Moves the cursor to the bottom row of the screen
Push Button
The Push Button will draw a 3-dimensional push button in the color
specified. Creating the 3D effect requires the use of three shades of the
same color: one for the highlight, one for the button color, and one for
the shaded portion. The default palette provides two shades of gray plus
high-intensity white. This is an ideal combination for push buttons and is
perhaps why gray buttons are so common. You can of course draw push
buttons using any combination of colors from the EGA or VGA color
palette.
The default palette offers two intensities of blue, green, cyan, red, violet,
and brown, which you can also use to draw push buttons. When a color
is selected from the Drawing Palette, the high-intensity shade will be used
as the highlight color and the low-intensity shade will be used as the actual
button color. The shaded portion of the push button will always be painted
dark gray. For the best effect, the dark gray portion of the button should
be changed to a darker shade of the button color. Since this darker color
does not exist in the standard palette, one of the other colors will have to
be modified to replace it. This can be accomplished by using the Palette
Editor to select the new color. Use the Recolor option to replace the dark
gray portion with the new color.
You can also draw any image or place text on the push button as long as
its border is at least 2 pixels from the highlighted or shaded portion of the
push button. Please refer to Figure 4.
2. Place the cursor at any corner where you wish to start the push
button and then click the left mouse button.
3. Move the cursor until the box is the size desired and then click the
■
left mouse button. The push button will be drawn in the selected
color.
You may continue to draw push buttons or return to the Drawing Palette
by clicking the right mouse button. Note that at this point the button is
just a graphic image and needs to be defined as a field* before it will
actually function as a push button.
*We recommended that you draw push buttons with the grid snap on. This
greatly simplifies the process of later defining them as fields.
Several other drawing tools are available, but they can be accessed only
from the pull-down menu. See the section Using the Menu System for
information on using these tools.
Drawing Aids
The following table lists the keys that control the mouse cursor during any
of the drawing or editing procedures. The X and Y snap space refer to
the current spacings set for Grid Snap.
~ Action
Left/Right arrow If snap is on, moves cursor one X snap space
right or left; if snap is off moves cursor one
II
pixel right or left
Up/Down arrow If snap is on, moves cursor one Y snap space
up or down; if snap is off, moves cursor one
pixel up or down
Tab Moves cursor 80 pixels to the right
Shift+ Tab Moves cursor 80 pixels to the left
Ctr! + Left/Right Moves cursor 72 pixels to the left or right
Ctrl + Up/Down Moves cursor 4 rows up or down
Home Moves the cursor to the left-most pixel, on the
current row
End Moves the cursor to the right-most pixel, on the
current row
PgUp Moves the cursor to the top of the screen in the
current column
PgDn Moves the cursor to the bottom of the screen,
in the current column
Enter Same as left mouse click
Escape Same as right mouse click
Grid Snap
The Grid Snap option allows you to set the X and Y increments allowed
for cursor movement. Increments are specified in terms of pixels and can
be set to virtually any number. This can greatly simplify the process of
making accurate drawings.
2. Set the desired spacings in the text boxes labeled XSnap spacing
and YSnap spacing.
Grid Snap can be toggled on and off at anytime during drawing or editing
by pressing the S (Snap) key. If active, the Status Box will indicate the
current snap status by showing the labels in upper case if snap is on, or
Painting Fields
Data entry fields use your computer's internal ROM fonts to display text.
The width of these fonts is always eight pixels but their height will vary
based on the screen mode you select. For 25, 30, 43, and 60-line modes,
the height will be 14, 16, 8, and 8 pixels high respectively.
When designing forms, it is common to paint the data entry fields a unique
color so that users can clearly see where the fields begin and end. Graphics
QuickScreen makes this a simple process by allowing you to define grid
I
snap spacings that correspond exactly to the standard text spacings. With
the proper settings you can use the Filled Box routine to paint regions that
correspond exactly to the size required by the data input routines. The
color you select for painting these regions will become the field's back-
ground color. The field's foreground color is assigned during the field
definition process.
The table below lists the grid snap settings to use when painting fields for
the different screen modes.
You can set these values in the System dialog box, or they can be set
automatically by pressing the F key while drawing or editing. The F (Field
Paint) key toggles between the current grid snap settings and the ap-
propriate settings from the table above. As you press the F key, you will
hear two different beep tones. When you hear the higher pitch, grid snap
is set to match text coordinates. The Status Box will display a black
rectangle when grid snap settings correspond to the current text size.
Note that when using the Filled Box routine with these settings, a special
condition applies. The height and width of the filled box will be one pixel
less than with any other setting. This is necessary to duplicate the exact
size of the background for the font that will be used for data entry fields.
This condition applies only to the settings that correspond to the text size
for the currently selected screen mode.
■
17 (in pixels). Note how the painted box is one pixel less than the actual
snap coordinate on the bottom and right sides, and that adjacent boxes do
not overlap. The drawing on the right shows the effect of the Filled Box
routine when grid snap coordinates are different from the text size. In
this case the painted region corresponds exactly to the grid snap settings.
r----,- 8 Phi e Is
r17
"I:_
Qpen ...
~auc
Sai,c ~s ...
fr Int Screen .. .
DOS Shell
I
i:xtt Proara111
I .
Draw
cally, and it also measures screen coordinates .
Compose Fields From this menu you may define, move, copy,
rearrange and print data field definitions. You
may also generates a BASIC source file to
display and edit your forms.
Keyboard
The keyboard interface to the menu system is very extensive. In general,
the direction keys are used to select a menu and a pulldown command.
Once a command is chosen, Enter is pressed to execute it, or Esc is
pressed to abandon the choice. Although it is common to rapidly develop
a "feel" for the menu system, the summary in Table 5 may assist you in
learning even faster. Please notice that some keys have more than one
function.
If you press the Alt key when Graphics QuickScreen begins, the menu
bar depicted in Figure 6 will appear. At this point you may scan across
the menu bar by using the Left and Right direction keys. Once the desired
menu (such as File) is selected, you may press the Up and Down keys
until the desired command (such as New Screen ... ) is highlighted. To
execute the command simply press Enter, or press the highlighted letter
corresponding to the command of your choice.
Once the screen editor is in use, the menu system is deactivated and the
menu bar will no longer be visible at the top of the screen. At this point
you may activate it by pressing Alt, or by clicking the left mouse button,
which will show the last pulldown menu used. Alternatively, you may
access a particular pulldown menu by pressing Alt plus the first letter of
the desired menu name. For example, to access the File pulldown menu,
press Alt-F.
■
Mouse
When pressed, the left mouse button toggles the menu bar on and off the
screen. Once the menu bar is displayed you may move the mouse cursor
over a menu item and press the left mouse button. To choose a pulldown
menu command, simply move the mouse cursor over the desired option
and click the left mouse button.
Some users may find that "dragging" the mouse produces better results:
Move the mouse cursor over the desired menu bar title and press and hold
down the left mouse button. You may then select different pulldown menu
commands simply by moving the mouse cursor along the pulldown menu.
If the mouse button is released while the mouse cursor is over a command,
then the command selected will be executed. You may also drag the mouse
cursor along the menu bar to view other pulldown menus before making
a selection.
If you do not wish to choose a command after you have activated the menu
system, simply move the mouse cursor away from the menu system. Then
either click or release the left mouse button or press Escape.
General Comments
Note that some pulldown menu commands are black while others are gray.
The black commands are active; the gray commands are inactive and will
■
produce no effect if selected. Once a form is loaded into the Graphics
QuickScreen editor many of the inactive choices will become active. For
example, under the File menu, the Save Paste Buffer... command will
not be active until something is loaded into the paste buffer.
Dialog Boxes
A pulldown menu choice followed by ellipses usually generates a dialog
box. Dialog boxes provide an effective way to gather information from
the user, and makes it easy to enter information or to select options.
Figure 8 depicts the Open File dialog box and highlights three major dialog
box input elements: the text box, list box, and command buttons. The
text box accepts a string of characters from the keyboard and allows the
entry of a path and file name. The list box presents items in a columnar
list. List boxes may hold many items and their contents may be scrolled
using the direction keys or scroll bar. The command buttons carry out the
designated command when chosen. Note that pressing Enter or Esc is
equivalent to clicking either the OK or Cancel command buttons respec-
tively.
Keyboard
When a dialog box is first presented the cursor will rest on a particular
input element. This cursor, or input focus, may be moved to the next input
element by pressing Tab, or to the previous input element by pressing
Shirt-Tab. The input focus may also be directed to a particular input
element by pressing the underlined or highlighted hot key for that element.
To direct input focus while in a text or list box use the Alt-hot key
combination.
Aside from these general directions, there are more specific ways to use
each dialog box input element with the keyboard:
■ Text Box
The Text Box accepts text which is typed by the user. When you first enter
a text field, typing any text character will clear the field and start a new
word. If you wish to edit the current contents of the text box without
clearing the field, press any of the direction keys before entering any text.
■
Selecting the field with the mouse also allows editing the existing text
without first clearing the field. You can also clear the field by pressing
Ctrl-C or restore the original contents by pressing Ctrl-R.
Multi-Line Text Box
The multi-line text box accepts text which is typed by the user. Text is
I
automatically word-wrapped as it is entered. Standard editing keys such
as Home, End, PgUp, PgDn and direction keys are also supported. You
can delete an entire line of text by pressing Ctrl-Y. Deleted text may be
inserted by pressing Shirt-Ins.
■ List Box
List box items are selected with the direction keys or by using the scroll
bar. When the desired item is selected you may press Enter to accept it.
■ Check Box
The check box is toggled by pressing the Spacebar.
■ Option Button
An option button is selected for a specific group by pressing the Up and
Down cursor direction keys.
■ Command Button
You may execute the highlighted Command Button at any time by pressing
Enter. You may also use Tub to access a particular command button and
press Enter. Further, pressing the underlined or highlighted hot key of
a command button will also execute it.
Mouse
If you have a mouse, you may access dialog input elements by clicking on
the desired element. More detailed instructions are summarized below.
■ Single and Multi-line Text Boxes
The mouse is not useful for entering information into a text box. You may,
however, direct the input focus to or locate the cursor in a text box by
clicking on it.
■ List Box
A list box item may be selected by double-clicking on it. Double-clicking
refers to pressing the left mouse button twice in rapid succession. If a list
box has more information, its contents may be scrolled by clicking the
mouse on the scroll bar. You can also select an item by pressing a key
that corresponds to the first letter of a menu item.
■ Check Box
I ■
■
The check box is toggled by clicking it with the mouse.
Option Button
An option button is selected by clicking on it with the mouse.
Command Button
You may execute a command button by clicking it with the mouse. Clicking
the right mouse button exits the dialog box as if Cancel had been selected.
file Menu
The File menu allows you to load and save full and partial screen images
in two formats. The File menu also lets you print the screen, execute a
DOS shell, and exit the Graphics QuickScreen program.
■ ~ewScreen
The New Screen option is used when you wish to start a new screen or
change to a different screen mode. You may select from EGA 16-color
If a screen is currently being edited and has been altered since it was last
saved, Graphics QuickScreen will prompt you to save before continuing.
Once the screen is successfully saved, the screen will be cleared to the
current background color. (The background color is set from the System
I
dialog box under the Settings menu.) All previously defined fields are
cleared from memory. The color palette will not be reset unless you
change to a different screen mode. This lets you use the color palette from
any other screen.
lose the mouse cursor after a new screen is loaded. In this case, the cursor
can be restored by pressing Ctrl-Fl.
Open File
File t!a111e :,..PCX
c:,GQS
I . Files:
CPALETTE. PCX •
:'°DEFMENU. PCX .
DEMOALL.PCX
DPALETTE.PCX
DRAWINGP.PCX
DRAWMENU.PCX
EDITMENU.PCX
FILEMENU.PCX
GQSBW.PCX •
QK I !;;ancel j
■ Save...
The Save option saves the screen currently being edited and creates a file
with the extension .PCX. (Graphics QuickScreen saves full or partial
graphic screens as .PCX files. This format uses a data compression
algorithm to minimize the amount of disk space used to store graphic
images.) If this is the first time a screen is being saved, a dialog box will
appear prompting you for a file name. This dialog box is shown in Figure
9.
Saue File
file Na111e: WORKING.PCX
c:,GQS
D ~aue partial .PCX I111age QK I I !;;ancel !
If you wish to save only a portion of the screen you can check the Save
Partial .PCX Image check box. Upon exiting the dialog box, you will
be prompted to identify the region to be saved. A drawing cursor will
appear as soon as you move the cursor allowing you to define the region
by drawing a box around it. (Note that partial .PCX images can only be
saved and restored using a mixed coordinate system of text columns and
pixel rows.)
■
If you have defined any fields for your screen, a Form (.FRM) file with
the same base name as your screen is also created. The .FRM file contains
information about the various fields that you have defined such as their
location, field name, field type, and so on. You may also save this
information in a BASIC source module that can be called from your
program by checking the Create BASIC .FRM tile box. (The .FRM file
will still be created as it is needed later to load the form back into the
Graphics QuickScreen editor.)
If a file name has already been assigned to your screen, selecting Save
will save the screen without prompting you for a new file name .
.PCX files employ a 128 byte header. This header contains information
about the size of the image, number of color planes, bits per pixel, and
palette information. Of the 128 bytes, only the first 67 are needed.
Graphics QuickScreen uses several bytes in the unused portion of the
header to store the screen mode and the height in pixels of a standard text
character for the current screen mode. This information tells Graphics
QuickScreen and the ShowForm subroutine the screen mode and number
of text rows to set. (Although it is possible to determine the correct screen
mode from the original .PCX file header, it is not possible to determine
the number of screen rows.)
If a partial .PCX file is saved, the upper left corner coordinates of the
image are saved into the header as well. There is no recognized standard
for partial .PCX image coordinates, so these bytes are unique to .PCX
screens saved by Graphics QuickScreen.
This data is placed in the .PCX header starting at byte 85 and is assigned
as follows:
Data
■
in the current screen mode. This value along
with the screen mode lets Graphics QuickScreen
and the ShowForm subroutine determine the
correct number of screen rows.
87 The upper-left pixel row of the saved image
{partial .PCX images only)
88 The upper-left text column of the saved image
{partial .PCX images only)
There are several advantages when using the .GMP format for saving small
screen images. Bitmapped images are not restrained by the mixed
coordinate system of text columns and pixel rows and can therefore be
easily restored to any X/Y pixel coordinate. They can also be displayed
more rapidly than partial .PCX images because they do not have to be
decompressed as they display. They can also be recalled into the Graphics
QuickScreen editor and easily pasted onto other screens.
Disadvantages are that the .GMP format requires more memory to store
a given image than the .PCX format, and that .GMP images do not contain
any palette information.
This method is best suited for displaying small graphic images very
quickly. (.GMP images are used to display some of the more elaborate
tool icons on the Drawing Palette.)
■ load Paste Buffer...
This option retrieves images that were saved with Save Paste Buffer...
option and it stores them in the paste buffer. These images can then be
placed anywhere on the screen by selecting the Paste option of the Edit
■
menu.
lrint Screen ...
This option takes a "snapshot" of the current screen and sends it to either
a 9-pin Epson compatible dot matrix or a Hewlett-Packard compatible
laser printer. The default printer port is set to I, but may be changed from
I
the System dialog box under the Settings menu. A dialog box will appear
prompting you for the following information:
Note that this option gives you a dot-for-dot reproduction of what appears
on the screen. Since the resolution for a video monitor and most printers
are different, the aspect ratio of the printed image may be somewhat
distorted. This is particularly true of EGA adapters at 640x350 resolution.
(The pictures shown in this manual were created with the Graphics
QuickScreen editor on a VGA display and printed on a laser printer at
either 100 or 150 DPI.)
Print Screen
■ .[!OSShell
The DOS Shell lets you perform DOS functions while Graphics Quick-
Screen remains in memory. In order for this feature to work properly, the
file COMMAND.COM should reside on the root directory of your boot
drive. You may specify where COMMAND.COM resides by using the
COMSPEC command in your AU1DEXEC.BAT file. For example, if
COMMAND.COM is on C:\DOS you may place the following command
in the AU1DEXEC.BAT file:
COMSPEC=C:\DO5
fdit Menu
The Edit menu lets you access a number of Graphics QuickScreen's graphic
editing tools.
■ .CopyBlock
Figure 11: The Edit Menu ■
This option allows you to capture an image from your screen and make
one or more copies of it anywhere you like. See Copy/Move/Paste under
The Drawing Palette section of this manual for more details.
■ MoveBlock
This option allows you to capture an image from your screen and move it
to a new location. The background color defined in the Settings menu is
used to replace the image once it has been moved. See Copy/Move/Paste
under The Drawing Palette section of this manual for more details.
■ faste
This option recalls the image that is stored in the paste buffer. When
selected, the image will appear in the upper left-hand corner of the screen
and it may be placed anywhere on the screen as if you had captured it with
the Copy procedure.
■ Flip Horizontal~ertical
The Flip Horizontal or Flip Vertical choices let you select any rectangular
portion of the screen and graphically flip it horizontally or vertically.
To Flip a region:
3. The image will be flipped as soon as you click the left mouse
button.
Note that even though the horizontal and vertical flipping algorithms are
very similar, flipping an image horizontally is considerably slower than
flipping it vertically because of the way video memory is organized.
■ Measure
The Measure option allows you to measure distances by row and column
or by X and Y pixels. Measurements are taken from the last point clicked.
Distances are displayed in the Status Box.
I To take a measurement:
I. Select Measure from the Edit pull-down menu. The Status Box
will appear if it is not already active. A drawing cursor will also
appear.
2. Click the mouse on whatever starting point you desire. The Status
Box will display the distance as you move the mouse cursor.
Pressing the T key will toggle between Text (row and column) and pixel
(x and y) coordinates.
Draw Menu
The Draw Menu is used to access additional drawing tools not found on
the Drawing Palette.
~... ,......
Tile ...
nrz I
2J,cn C:W-ue
Closed CurYC
Scroll Bir
■ frint Text
This option allows you to type text onto the screen using standard row and
column coordinates. This routine uses the same ROM font used by your
computer but prints without disturbing the underlying screen. See Print
Text under The Drawing Palette section in this manual for more details on
using this option.
■ llrawText
■
This option is used to print text in a selected font anywhere on the screen
at any angle and in any color. The text may optionally be scaled and/or
italicized.
To draw text:
I. Select Draw Text from the Draw pull-down menu and a dialog
box will appear.
Font: Select the desired font. Five pre-defined fonts are available,
or you can select from fonts that you have created using the GPFont
editor utility program*.
Scale: Enter the scaling factor. The range for scaling is from
approximately .75 to 50, and can be any fractional value in
between. A value of 1 produces a font in the point size specified.
Values less than .75 are acceptable but generally produce poor
results. As the font is scaled up the apparent resolution goes down.
This condition is inherent in almost any scaled font.
Text Angle: Enter the desired angle at which to draw text. A value
of O draws text horizontally. Positive angles rotate the text
clockwise while negative angles rotate the text counterclockwise.
To create bold fonts, print the text as usual but do not move the cursor.
With grid snap off, press the Right or Left arrow key to move the cursor
one pixel to the right or left, and then press Enter. The text will be drawn
again offset by one pixel creating a bold effect. Shadowed or embossed
text can be created by changing colors before drawing the text a second
time.
Draw Text
Iext: !text to be displayed
o Helvetica
l0O ~•ucttc~
Bpt O gld English 12pt
1.?Pt O U~er 1
@l.fr.ites Ro...an Ia,etl O !Jser Z
~utura O Us~r 3
I §cale:
Iext Angle:
!tal.Angle:
;a DO
8 I C~nccl I
■ Jile
The Tile palette gives you access to an additional 119 dithered colors and
28 different tile patterns using only the 16-color palette.
I
pattern is defined and then repeated much like tiles on a wall. These tiles
are generally used as fill colors when 16 colors are inadequate, or to
produce interesting backgrounds for your screens.
The tiling procedure works just like the Flood Fill option on the Drawing
Palette, and it will fill an entire area contained within a single color. (See
Flood Fill under The Drawing Palette section for more details.)
To tile a region:
I. Select Tile from the Drawing pulldown menu. The Tile Palette
will appear at its last used location. The Tile Palette can be
placed anywhere on the screen by clicking the bar at the bottom of
the palette and dragging it to the desired position.
2. Select a tile by clicking on it with the left mouse button. The Tile
Palette will disappear. Paint the region by pointing and clicking
the mouse as you would for the Flood Fill procedure.
The Tile Palette image is stored as a bit map in the TILEPAL.GM4 file.
The tiles are stored in the file TPAL.TIL. These files should reside in the
current directory or in the directory specified in the Set Paths dialog box.
1. Select Open Curve or Closed Curve from the Draw menu and a
I
drawing cursor will appear.
2. Draw lines that roughly define the shape of the curve, similar to
the line drawing procedure. You are allowed up to 100 line
segments to define the shape.
3. Click the right mouse button when you have completed the rough
outline to end line drawing. If you change your mind or make a
mistake when defining the outline, click the right mouse button
again to delete the line segments and start a new curve. If you are
satisfied with the shape, click the left mouse button and the line
segments will disappear. A hyperbolic smoothing algorithm is
applied to the shape you have defined, and a "smoothed" version of
your outline will be drawn.
An open curve differs from a closed curve only in that the endpoint will
be smooth! y joined to the starting point. This can be an important
difference depending on the desired result.
You may continue to draw smoothed lines or you may return to the Drawing
Palette by clicking the right mouse button.
■ Horizontal/Vertical Scroll Bars
Scroll bars provide an easy way for users to enter a number from a range
of values in your programs. Like push buttons, they can be drawn in any
color but require three shades of the same color for the best 3D effect.
See Push Button under the Drawing Palette section of this manual for a
■
more detailed description on using colors. The sliding range of the scroll
bar can be changed to any other color as well.
2. Place the cursor at any corner where you wish to start the scroll
bar and then click the left mouse button.
3. Move the cursor until the box is the size desired and click the left
mouse button. If the box is wider than it is high, a horizontal
scroll bar is drawn. If the box is higher than it is wide, a vertical
scroll bar is drawn. The scroll bar will be drawn in the selected
color.
4. If you wish to use a different color for the sliding portion of the
scroll bar, use the Flood Fill routine from the Drawing Palette to
paint the new color.
You may continue to draw scroll bars or return to the Drawing Palette by
clicking the right mouse button.
Note that at this point the scroll bar is just a graphic image, and needs to
be defined as a field* before it will actually function as a scroll bar.
'~::::!~
::=::=I H~ ~
============================~::;::@
____I _ _ _ _ _WbJ WW
@
Figure 16: Scroll Bars
Scroll bars may be almost any size but the length should be no less than
49 pixels to allow room for the two push buttons and the scroll pointer.
* We recommend that you draw scroll bars with grid snap on. This greatly
simplifies the process of defining them later as fields .
.Settings Menu
I - F1 e t:d1t Draw
~alcttc...
Status Box
Conpose Helds I
,bine Type...
~yste111. ~.
Set Paths ...
FS
F3
FB
F6
easy to line one object up with another. You will notice that when drawing
vertical or horizontal lines with either the Crosshair or the Full Crosshair
that the part of the cursor that is over the "rubberband" line appears in a
different color. It also changes as the background color changes.
This is a side effect of the XORing .technique used to draw both the line
and the cursor. This will rarely cause a problem and is often useful when
trying to locate the cursor precisely at an edge where two different colors
■
meet. If for some reason this is a problem, you can use the X Crosshair
instead. The square cursor is primarily used for the paintbrush routine,
but it can be used for drawing as well. Its size will correspond to the
Brush Size specified in the Settings dialog box.
Select Cursor
@[~ross Hair! OX
O Fu II C!:OSS Hair
O ~ Cross Hair j Cancel I
0 Squa!:e
@[A IO~·
0 !! .. .......................... 0 [ ··-·-·-··-·-··-··-·
DI]
0 !;--------------- O §---------------
0 !! - - - - - - - - 0 Custo10 !!ask
I!;ancel !
Custo10 Line !!ask: !1111111111111111!
All subsequent line, box and polygon drawing will be performed using the
selected line type. You can easily toggle between the selected line type
and solid line drawing by pressing the backslash (\ I) key. A single beep
indicates that solid line drawing is in effect, while two beeps indicate that
a broken line type is in effect.
■ falette
The Color Palette lets you assign any of the EGA palette's 64 colors or
I any of the VGA palette's 256k colors to any of the 16 drawing palette
colors. Use of the proper colors can greatly enhance the appearance of a
well designed screen.
3. Cycle through the 64 EGA colors by using the scroll bar at the
bottom of the editor. The new color will be assigned to whichever
color you select.
The VGA palette editor allows you to mix your own colors by providing
three scroll bars to control the red, green, and blue components of the
color. These values can range from O (off) to 63 (full intensity). The
selected color will be assigned to whatever color you create. When
controlled from the keyboard, scroll bars are accessed by pressing Tab or
Shirt-Tab and are controlled using the cursor direction keys.
■ Status .llox
The Status Box can be used to display the current setting of several
different drawing and editing parameters. It can be placed anywhere on
the screen by clicking on it with the mouse and then dragging it to the
desired position as long as no other pop-ups are active.
- u r r e n t Color
I !X:385 y:34311
Relative Mode On
1. Select the System ... option from the Settings pulldown menu. A
dialog box will appear prompting you for the following information:
- Block Options:
Copy/Move Block Determines whether copy or move is active
when the Copy/Move icon is selected from the
Drawing Palette. The default setting is for copy.
■
The default background color is black (0).
■
character to appear whenever New Screen ...
is selected from the File menu. The default
setting is off.
- Clear on Delete When checked, fields will be cleared to the
current background color when they are
deleted during the Enter Field definitions
procedure.
- Corner Radius Sets the desired corner radius in pixels to be
used with the radius box drawing procedure.
Values can range from 1 to 999 pixels. The
default value is 15.
- Brush Size Determines the size in pixels of the paintbrush.
This setting also controls the size of the square
drawing cursor.
- Mouse Sens. Determines the sensitivity of the mouse cursor.
This setting can range from 1 to 99, but its
useful range is from 1 to about 30. Values
above 30 or so are hopelessly insensitive. As
a reference, the mouse sensitivity setting within
the QuickBASIC editor defaults to about 10
while the Graphics QuickScreen default is set
to 4.
Systell Settings
Block Options ~
r @ Copy B!ock !!G Color: [QI 1 ~ l;ancel
O ~ove Block D !!OR On
I !
' - - - - - - - - - - - - - - ' 181 Pixel Grid On
Status Dlsp lay □ Show Gr id
r O _Text_ Coords__
® !Pixel Coords JD Status On
I 181 Clear on J!elete
Corner Radius: ~S
Snap S e t t i n g s - - - - - - - , Brush Size: 8
r X Snap Space: ~ I Mouse Speed:
X Snap Space: IE) 181 S!!ap On P!:inter Port: 1
S
S.et Paths
The Set Paths option lets you specify the new drive and directory where
the various Graphic QuickScreen support files are located. These files are
the Drawing Palette icon files (SCRIBBLE.GMP, PBRUSH.GMP, BUCK-
ET. GMP, and CLRWHEEL.GMP), the TIie Palette bit-map and its related
tile file (fILEPAL.GM4, TPAL.TIL), and the font files used by the Draw
Text option (files with a .GFN extension). This lets you run GQS from
I -
any other directory and still have access to the required support files.
The new paths are stored in the GQS. CNF configuration file that is created
whenever you end the program. This file is saved in the current directory
and loaded automatically whenever GQS is run again from the same
directory.
Set Paths
!con CI les: jjgruf
J'lle flies:
[ont files:
::(C:~,G=QS' .:::==========:::'.
o,,IC·,o,,,G,,.gs,___ _ _ _ __J
Ow
I
This selection allows you to move a field or range of fields anywhere on
the screen. Fields are moved using a procedure very similar to the graphic
Move Block procedure found on the Drawing Palette or under the Edit
menu. Move Fields differs from Move Block in that if the area selected
contains previously defined fields, the field definitions are moved along
with their graphic images.
Only those fields whose four corners fall completely inside the encom-
passing box will be moved. Moved images are replaced with the current
background color. The background color is set in the System dialog box
found under the Settings menu.
You may use any Grid Snap settings to identify and move the region.
However, if the region contains any text entry fields, Graphics Quick-
Screen will limit movement such that the field can only be placed at
standard text rows and columns. Mouse fields, push buttons and scroll
bars can be moved to any pixel location. Text fields cannot be moved to
the bottom screen row.
■ Copy Fields
This selection copies a field or range of fields to eliminate the need to
manually type in duplicated information. Fields are copied using a
procedure very similar to the graphic Copy Block procedure found on the
Drawing Palette or under the Edit menu. Copy Fields differs from Copy
Block in that if the area selected contains previously defined fields, the
field definitions are copied and moved along with their graphic images.
Unique field names are automatically created for each new field. Only
those fields whose four corners fall completely inside the encompassing
box will be copied.
You may use any Grid Snap settings to identify and move the region.
However, if the region contains any text entry fields, Graphics Quick-
Screen will limit movement such that the field can only be placed at
standard text rows and columns. Mouse fields, push buttons and scroll
bars can be copied and placed at any pixel location. Text fields cannot be
copied to the bottom row of the screen.
This feature provides an extremely fast way to generate new fields without
going through the entire field definition process.
■ Rearrange Data Fields...
This selection allows previously-defined data fields to be moved from their
data entry order (when Enter or Tab are pressed).
■ frint Field Definitions...
I ■
This option creates a printed listing of all field definitions for the current
form and thus serves as a handy documentation utility. This printout
information is sent to any printer port. The printer port can be assigned
from the System dialog box under the Settings menu. The default port
is LPTI.
Make.!!emo...
This selection creates write a BASIC source file that you can use as a
starting point to help develop your own source code. The code produced
will run as if Try Data Entry in Form had been selected.
When you select Make Demo... a dialog box will appear prompting you
for the following information:
Use .FRM File This option causes the form definition file to be
loaded from disk. This provides the smallest
.EXE size but requires that the .FRM file be
distributed along with your program.
Use BASIC module This option creates and assigns the form defini-
tions from a BASIC module. This allows you
to include the form definition file directly into
your final .EXE program but results in a some-
what larger program compared to loading the
field definitions from disk.
When you are satisfied with the demo settings, click OK to generate the
BASIC code. A .MAK file that includes all of the required modules for
your form will be created, as will a main module that calls up your screen
and form definition file. These files will be placed in the current working
directory. To run the demo, follow these steps:
■
2. Log on to your working directory and start BASIC with the
appropriate library:
4. Load the demo using the Open command from the File pulldown
menu.
Make De1110
OJ<
I Cancel !
!!e111onstrat ion File Na111e: !DEMOWORJ<!
■
- Function Keys
Function keys can be used to execute a number of the common! y used
menu commands. Their functions are listed in the table below:
~ Action
Special Keys
Several keys have been defined to serve as toggles for changing the status
of the various drawing and editing parameters. These keys and their
functions are listed in the table below:
~ ;..:A:..::c.ccti"'o""n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ____,
■
(Row/Column) coordinates and pixel (X/Y) coordinates.
I'
I Toggles the line type for drawing lines, boxes and
polygons between solid and the previously selected line
type. A single beep indicates that solid line drawing is
in effect while two beeps indicate that the previously
selected line type is active.
Fields
Graphics QuickScreen has the ability to create fields which gather user
input when a form is used from BASIC. A screen with field definitions
is called a form. When using forms from BASIC, field information may
be passed to and from a calling program.
Field Types
■
The field type describes the data which is to be entered at a particular
field. For example, there is a Social Security Number field type which
accepts numerical information only in the fonn ###-##-####. Graphics
QuickScreen contains built-in logic for each field type, making additional
formatting or syntax-checking by the calling program unnecessary.
Graphics QuickScreen also supports four additional field types that do not
accept data but must be defined as fields for them to function. These are:
mouse fields, push buttons, horizontal and vertical scroll bars.
Certain field types are fixed-length and generate mask characters. These
are simply delimiting characters such as the dashes in a social security
number that help to format a field on the screen. Graphics QuickScreen
inserts mask characters for you and skips over them automatically when
the field is being used in a fonn.
■ Scrolling Text
Lines of text longer than the actual defined text window may be entered.
You may also specify what type of text is to be accepted from 5 options:
I . All characters
■ Currency
An amount of money in the double-precision range is accepted. The
currency symbol for the field may be defined so that dollars, yen, or other
currencies may be used. Note that this field does not use the Currency
data type.
■ Date MM-DD-YYYY
I
A date in the default range 01-01-1900 to 01-01-2065 and in the American
format (MM-DD-YYYY) is accepted. The dash (-) mask character is
added automatically.
■ Date DD-MM-YYYY
A date in the default range 01-01-1900 to 01-01-2065 and in the European
format (DD-MM-YYYY) is accepted. The dash (-) mask character is
added automatically.
■ Phone Number
A phone number in the form (###)###-####is accepted. The parentheses
and dash mask characters are added automatically.
■ Zip Code
A zip code in the form#####-#### is accepted. The dash mask character
is added automatic, II y.
■ Social Security Number
A social security number in the form ###-##-#### is accepted. The dash
mask characters are added automatically.
■ Relational
Allows you to specify what file and which field in that file is to be used
for the current field. Although Graphics QuickScreen does not process
these fields automatically, relational fields allow a calling program to
access data in other form files.
■ Multiple-Choice Array
Presents a vertical menu of choices. This menu is defined in a string array
by the calling program and then displayed whenever the field is accessed.
Menu colors are set in the GPDat% Oarray.
■ Mouse Field
Mouse fields allow you to define rectangular regions on the screen that
will return a single user-defined key code whenever they are selected in
a form.
it. The field can be outlined when it is the current field and can also be
highlighted in any color when activated. The field may also be set up to
function as a toggle such that each selection highlights or un-highlights
the field.
When defined as a toggle, a mouse field will occupy one byte in a data
file. Otherwise, a mouse field contains no data and will not occupy space
■
in a data file.
■ Push Button
Push buttons return a single user-defined key code whenever they are
selected in a form. Common example push buttons are OK and Cancel,
which would typically return the key codes for Enter and Esc, respective-
ly. Although the button fields may show any words or pictures and return
any keycode you choose, they always return a single value.
Push buttons do not have any data associated with them and thus do not
occupy space in a data file.
■ Horizontal/Vertical Scroll Bars
Scroll bars provide an easy way for users to enter a number from a range
of values in your programs. The numbers that they may represent can
range anywhere from -32768 to 32767 and can be returned in any step
increment. See Scroll Bars for more detailed information.
• String
String Alphanumeric characters
Proper String Alphanumeric characters; the first letter of each
word will be capitalized
Upper case String Alphanumeric characters; each alphabetic char-
acter will be capitalized
I
Numeric Numeric characters only
Multi Line Text Alphanumeric characters; several lines of text
may be entered and edited
Scrolling Text Single line text that may be scrolled left or right
Numeric
Integer -32768 to 32767
Long Integer -2,147,483,648 to 2,147,483,647
Single Precision 3.402823 E+38 to 1,401298 E-5
Double Precision 1.7976931 0+308 to 4.940656 D-324
Currency 1.7976931 0+308 to 4.940656 D-324
General
Logic A "true" or "false" character
*Date (US) MM-DD-YYYY (MM=month, DD=day,
YYYY=year) 01-01-1900 to 11-17-2065
*Date (European) DDD-MM-YYYY 01-01-1900 to 11-17-2065
*Phone Number (###) ###-####
*Zip Code #####-####
*Social Security ###-###-####
Special
Relational Relates the current field to a field in another file
Mutt-Choice Array Presents a vertical menu of choices
Push Button Returns user assigned key code when activated
Mouse Field Returns user assigned key code when activated
Horizontal
Scroll Bar -32768 to 32767
Vertical Scroll Bar -32768 to 32767
Fields designated with an asterisk (*) generate mask characters
I Current Fieldl: 1
I LEE:] I ~ancel I
Text Fields - ForJ'l'latted
O S!ring O C!,!rrency
O !'roper String 0 Date MM-DD-!:
@[QCase_String I 0 Date D]!-MM-Y
O Nuner ic Te~t
0 t!ultiLine Text
O Sc!:oll ing Text
Nurraeric
O
O
0
!,ogical
!nteger
!,ong Integer
0
O
O
!'hone Nunber
~ip Code
~ocial Security
Special
O !le Jationa I ...
O t!ultiple Choice
O Mous!, Region
I
O ~ingle Precision O !'ush Button
O ]!ouble Precision 0 ~croll Bar
Field Settings
Each field has a group of user-assigned attributes that collectively are
called Field Settings. These attributes are set using dialog boxes, one of
which is depicted in figure 26. This figure shows an example Field
Settings dialog box which is generated for the Currency field type. It is
important to realize that certain fields will generate dialog boxes containing
slightly different options. For example, the push Button field type dialog
box queries for a key code value to be returned when activated.
■
!:!elp !Enter the current sales price
Nessage .
■
■ Highlight Color
The highlight color specifies the color to use when a mouse field is
selected. Since the specified highlight color will be XORed over the
existing color, the actual color will vary with the underlying color. A
value of 0 will not display a highlight. To determine a specific highlight
color over a given background color use this simple formula:
You would therefore assign color 5 (normally violet) as the highlight color
in the field definition dialog box. You can use the BASIC editor's
Immediate mode to calculate the appropriate value: PRINT I XOR 4.
■ Indexed Field
This input element should be checked if the current field is to be indexed.
the leading CHR$(0). Some common key codes are shown in the following
example:
Enter 13
Esc 27
65
I
A
FlO -68
PgUp -73
■ Large Change
When a scroll bar is active, this value indicates the amount of change when
clicking on the sliding portion of the scroll bar or when pressing PgUp or
PgDn.
■ No Formatting
This input element should be checked if a number is to be displayed as it
was entered by the user. If this option remains unchecked, then numbers
are right-justified.
■ Protected Field
This input element ,hould be checked if the current field is to be protected
against modification. That is, the field will be a display-only field. Any
field type can be protected but there must be at least one non-protected
field on each form.
■ Range
Specifies the upper and lower limits for numeric input, or the date range
for date input between which entered values must fall before being
accepted in a form.
■ Relational Field
This option lets you specify a file and field name for a relational field. A
calling program may use this information to form a relational link to data
in another data file.
■ TabColor
For Mouse fields, the color to use in order to indicate the outline of the
field whenever tabbed to or selected with a mouse. A value of O will not
display an outline. Since the specified Tab color will be XORed over the
existing color, the actual color will vary with the underlying color. To
determine a specific outline color over a given background color use this
simple formula:
■
Color= (Existing Color) XOR (Desired Tab Color)
For example, if the background region is blue and you want the outline to
appear red:
You would therefore assign color 5 (normally violet) as the Tab color in
the field definition dialog box.
■ TextColor
Specifies the text foreground color for the field. The text background
color will be whatever color the field was painted.
■ Toggle
When checked, a mouse field will toggle between the highlight color and
the original color each time the field is activated. (When highlighted,
Form$(N, 0) will contain an "X", otherwise it will hold a single space.)
■ True Character
The character to be accepted as true in a logical field. The space bar will
toggle between true and false characters during operation.
■ Numeric Formulas
Field calculation formulas in Graphics QuickScreen use the same syntax
that BASIC uses. For example, you would calculate the total price for an
item which costs PURCHASE dollars (where PURCHASE is a field name)
and is taxed at 6 % as follows:
, Functions
■
Name Value
, Constants
Name Value
Pi 3.14159265358979323846
■
E 2.718281828459045
, Math Operators
, Relational Operators
Operator Purpose
Power
* Multiplication
I Division
\ Integer Division
MOD Module
+ Addition
Subtraction
Operator Purpose
Equal
> Greater than
< Less than
Boolean Operators
I .
AND
NITT
OR
Scroll Bars
Scroll bars allow the user to enter a number from a range of values. Upper
and lower limits can be set to any values ranging from -32768 to 32767.
Numbers can be returned in any step increment that you specify.
Two different step sizes are available for each scroll bar. These are
specified in the field setting dialog box in the Small Change and Large
Change text boxes. The Small Change value specifies the amount of
change when using the Up/Down/Left/Right cursor arrow keys or when
clicking on the direction scroll buttons. The Large Change value specifies
the amount of change when clicking on the sliding portion of the scroll
bar or when pressing PgUp or PgDn. In addition, pressing the Home key
selects the low limit while the End key selects the high limit.
The lower limit must always be less than the upper limit. To make the
scroll bars read backwards such that the high value is indicated when the
scroll pointer is at the top or left of a scroll bar, subtract Fld(N). Value
from Fld(N).HiRange. See Handling Scroll Bars for more information.
CREATING SCREENS
Graphics QuickScreen's editing features make it very easy to create screens
and embellish them with sophisticated graphics and color. Its user
interface allows you to paint your data entry screens much as you would
paint screens in a conventional paint program.
■
screens must also have been saved in either the 640x350 or 640x480 16-
color mode. These screens can then be loaded into the Graphics Quick-
Screen editor for further enhancements and the addition of data entry
fields.
It is important to understand that the graphic image of the forms you create
and the field definitions themselves are stored in two completely separate
and independent files. The screens that you paint are simply blankfonns
on which to perform data entry. What you draw affects only what
background color is used for text fields and identifies the placement and
color for push buttons and scroll bars.
The process for creating data entry screens in the Graphics QuickScreen
editor can be broken down into four basic steps:
begin and end. When your program runs, the EditFormG subroutine reads
the existing background color from the screen for each field as it is
encountered. EditFormG uses whatever background color it finds when-
ever printing text to the field.
Since all text entry fields must be located at standard text rows and
columns, you must be careful when painting fields to locate the field's
coordinates correctly. This is easily accomplished by setting Grid Snap
values that correspond to the current screen mode's text size. (See Painting
Fields for more information.) Mouse fields, push buttons, scroll bars,
and constant text are not restricted by text rows and columns and can be
I
placed at any pixel location.
Defining Fields
The following sequence shows the steps needed to define any data field:
■
are defining mouse fields, push buttons, or scroll bars, the initial starting
point is irrelevant since it will be redefined after the next step.
Third, choose a field type from those presented. Fourth, adjust the field
size, keeping in mind that you must allow enough space to hold the field's
data. You should consider that dashes, commas, and other "mask"
characters occupy space in the field and should be considered when
adjusting the size.
If you are using a form and notice that a numeric field is filled with percent
(%) symbols, then the data in that field is exceeding the field's size. This
usually indicates that the field must be made larger.
If you selected mouse field, push button or scroll bar, you will be prompted
to define the field by drawing a box around it. For push buttons and scroll
bars to function properly, this box must overlay exactly the black outline
of the image. When the size is correct, all sides of the encompassing box
will appear yellow.
The last step is to complete the field settings by specifying the field name,
text foreground color (if applicable), associated formula, help message,
and other available options. Field names are assigned automatically by
Graphics QuickScreen, but they may be changed to any other unique name.
Try to define the fields in the same order you wish them to be used in the
form. This reduces the likelihood that you will need to use the field
Rearrange features, discussed later in this section.
Often, you will notice ways that the form can be improved once you create
it. Editing fields already on the screen is easy. Simply access the
(Compose-Fields) Define Data Fields menu option. You can use the +
and - keys to access the next and previous fields, respectively, in the form.
Pressing Del deletes a field from the form, while pressing Ins inserts a
field before the current field.
You can also directly access any predefined field during step 2 by pressing
the Tub key, or by clicking on the field's number shown in the dialog box.
The field's number will become a text box allowing you to enter the desired
field number. Press Enter or click the mouse anywhere outside of the
field number's text box to jump to the specified field. Entering a number
I greater than or equal to the highest field number will select the last field.
Rearranging Fields
If you need to rearrange the order of fields on a form you will use the
(Compose-Fields) Rearrange Data Fields ... command. This generates
the dialog box similar to the one shown in Figure 27.
Rearrange Fields
Select the field to 111oue:
Fields:
a1L...i1r•w•-
EDATE
♦
I OK
I
PHONE
'-
I Cancel I
ZIP
SOCSEC
MONE'/
INT
'IESNO .
Figure 27: Rearrange Fields Dialog Box I
Fields may be re-ordered in the Rearrange dialog box by first selecting
a field in the list box and then clicking the OK push button. You will then
be able to position the selected field above or below another field in the
list box. Clicking OK again inserts the selected field at the indicated
position. Clicking Cancel will instead exit the dialog box.
I
headings summarized in Table 16.
* The LPT? number is specified in the System dialog box under the
Settings menu. The default is for LPTI.
Saving A Form
Creating a data entry screen usually takes both care and time. You will
want to save often while designing or making changes to your form by
using the (File) Save ... menu command.
I
Screen will not overwrite the existing .FRM file (since doing so could
make the existing data file unreadable). Instead, a file with the extension
of .NEW is created. In this example, MYFORM.NEW would be created
instead of MYFORM.FRM.
To display and edit forms in your program, you will first need to assign
the form definitions arrays from either the .FRM file or the .BAS source
file. The GetFldDefG BASIC subroutine is provided to read the .FRM
file and assign it to two arrays, FldO and Form$Q.
If you prefer to code the field definitions directly into your source code,
you can instead call the BASIC subroutine optionally created when you
saved your form. This source file will have the same name as your form's
.PCX file, but with a .BAS extension. When called, it performs the same
function as the GetFldDefG subroutine.
The FldO array is a TYPE array that contains field attributes such as the
field's row, left column, right column, field type, and so on. See the
FLDINFO.BI TYPE structure definition for more information.
Element 0 of both the FldO TYPE array and the Form$() array contain
general form information. The Fld(0).xxx elements contain information
such as the total number of fields, total length of the form, and the number
of text rows. Form$(0, 0) is of particular interest because it contains all
field input combined into a single string ready to be written to disk.
Numbers are placed into Form$(0, 0) as IEEE formatted strings. This
string can then be copied directly into a variable of the TYPE structure
defined in the .BI file created when you saved your form. The entire form
can then be saved as a record in a random file by PUTing this TYPE
■
variable to disk.
After the field definitions have been assigned, forms are displayed by
calling the Show Form subroutine. This routine first sets the proper screen
mode, color palette, and number of screen rows, and then displays the
screen.
Once the form definitions have been loaded and the screen displayed, data
is entered into the form by calling the EditFormG subroutine. EditFormG
is a pollable routine that reads the field information and handles all user
input while editing the form. It also returns several variables that may be
examined to determine the current editing status.
All data entered into your form is stored as a string in the Form$(N, 0)
array. (N represents the field number.) Numeric fields are stored literally
as they appear on the screen. Field data is also stored in Form$(0, 0) as
a single continuous string that has numbers and dates formatted as IEEE
formatted strings.
When editing is complete, all user input in the form is contained in the
Form$() array. If you wish to save your form as a record in a random file,
the SaveRec and GetRec routines are provided to save and retrieve this
data.
■
I
Graphics QukkScrccn Routines
Integers
Throughout the remainder of this manual we will make reference to several
important integer variables, such as Action and ErrorCode. As you may
know, such variables are represented in BASIC with a trailing percent sign
(% ). Thus, X% refers to an integer variable. You will notice, however,
that many examples and discussions which use integer variables omit the
percent symbol. The reason is that our sample programs and program
fragments assume the presence of a DEFINT A-Z statement, which
ensures that variables lacking a type identifier are integers by default.
I
We have retained the type identifier when showing the calling syntax for
the Graphics QuickScreen routines to clearly show which parameters are
integers.
Parameters
A parameter is a variable which appears at the top of a subprogram or
function heading. For example:
SUB GPrintOVE(Row%, Col%, Text$, Colr%)
Here, Row%, Col%, Text$ and Colr% are variables in the parameter list.
There must always be a one-to-one correspondence in both number and
type for the arguments and the parameters used when implementing a
routine. For instance, if a particular routine was designed to accept 5
parameters, then you must pass exactly 5 arguments to the routine when
you call it. And if the first parameter expects an integer, you must use an
integer as the first argument.
Arguments
An argument is a variable or value used when calling a subprogram or
invoking a function. For example:
CALL GPrintOVE(Row%, Col%, Text$, Colr%)
Here, Row%, Col%, Text$ and Colr% are the argument list. The variable
Text$ could be replaced by the literal "Hi there!" if desired. Similarly,
the integer argument Colr% could be replaced with the integer constant
12. Arguments are passed to and used by the subroutine being called.
When arguments are variable names (rather than numbers or strings) the
subroutine being called may modify them and make their new values
available to the calling program.
Action
The action parameter is used by many of Crescent Software's pollable
routines. The integer value contained in Action tells the called subprogram
what it should do. Graphics QuickScreen uses a pollable routine called
I
EditFormG which serves as the core forms-processing subroutine. When
using EditFormG, Action may be set to 1, -1, -2 or 3. Table 17 summarizes
how these values affect the operation of EditFormG.
Note that Action -1 is used only when a push button or highlighted mouse
field is used to call up another form. This prevents the push button or
mouse field from the first form from being restored (displayed) on the
second form.
Form$() Array
The Form$0 array is a conventional (not fixed-length) 3-dimensional
string array used to store information both about a form and about the
fields it contains. The first subscript must be dimensioned to the total
number of fields in the form; the second subscript is always dimensioned
to 2.
A special area of the Form$0 array called the form buffer is stored in the
array element Form$(0, 0). The form buffer collects information from
all fields and formats them into a single fixed-length structure. This lets
you use random file commands to quickly load and save form information.
All of the fields in the form are stored in the Form$(0, 0) array element
with one exception: data from notes fields are stored in separate notes files
having a .Nor extension. (A multi-line text field is considered a note
field.) When a notes field is in the form buffer, four bytes are reserved
to hold an offset into the . Nor notes file. The position in the .Nor file
pointed to contains a two-byte integer value which gives the length of the
note. In this way a linked list is created between the form buffer and the
■
current notes file.
When this line is encountered by the compiler, the contents of the path
and file name enclosed in single quotes are read and compiled. If the file
cannot be found on the directory specified, then the path stored in the
INCLUDE environment variable is accessed. If the file still cannot be
located, then the compiler reports an error.
I
SETUP.BAS
FLDINFO.BI
EDITFORM.BI
SETUP.BAS
SETUP.BAS is an include file that should be entered as the first executable
statement in your programs. It determines the current monitor type and
sets up the GPDat%0 array. The GPDat%0 array is a COMMON
SHARED array that contains useful information about the current form
and screen mode. This information is used by several of the Graphics
QuickScreen subroutines. See Appendix A for a complete description of
the GPDat %() array.
FLDINFO.BI
FLDINFO.BI includes the field information TYPE array and several
constant assignments. This user-defined TYPE is required by a calling
program to obtain information about a field in the current! y-active form.
The Fldinfo TYPE structure looks like this:
TYPE FieldinfoG
Fields AS INTEGER
Row AS INTEGER
LCol AS INTEGER
RCol AS INTEGER
StorLen AS INTEGER
FType AS INTEGER
RelFile AS STRING* 8
RelFld AS INTEGER
Indexed AS INTEGER
FldName AS STRING• 8
Decimals AS INTEGER
RelHandle AS INTEGER
Protected AS INTEGER
Scratch! AS INTEGER
LowRange AS DOUBLE
HiRange AS DOUBLE
ScratchS AS STRING• 8
Value AS INTEGER
END TYPE
Dimensioning any array to zero elements simply defines the array while
committing the smallest block of memory possible. The Fld() array will
■
be redimensioned later to the actual number of fields in the current form
using the NumFieldsG function or by calling the optional form definition
BASIC module. This way the array will be made only as large as it needs
to be.
When a form is loaded, the calling program may obtain specific informa-
tion about each field using the Fld() TYPE array. For example, to find
out whether the field number 3 is protected the calling program would use
a statement like:
IF Fld(3).Protected THEN ...
The program can also access a field's position on the screen and for
applicable fields, its low and high ranges for acceptable data entry. As
you can see by examining the TYPE definition, many other field charac-
teristics are available to your program as well.
The Fld() TYPE array reserves element 0 for special use. For example,
Fld(0).StorLen contains the record length, in bytes, of the entire current
form. However, Fld(l).Row contains the row position for field I on the
form. Only Fld().Fields, Fld().Row, Fld().LCol, Fld().StorLen,
Fld(). Value and Fld().Indexed make use of the zero element, however.
Element Description
■
pixels
RelHandle The BASIC file number for the related file; this
number may be used for GET # and PRINT #
statements; for scroll bars, the current screen
pointer position
I
Scratch! For mouse fields, push buttons and scroll bars,
the bottom right corner row of the field; for
Scrolling Text fields, the character to display
at the left of the edit window; for Multi Line
text fields, the bottom screen row of the field;
unused for all other field types
The constant assignments in the FLDINFO.BI file make it easy to use the
FTYPE element of the FieldlnfoG TYPE. For example, if you need to
know if the current field is a Proper String, you could use a statement
similar to:
IF Fld(CurField).FType = PropstrFld THEN
CONSTANT DECLARATION
CONST StrFld = 1 String
CONST PropStrFld = 2 Proper string
CONST UCaseStrFld = 3 Upper case string
CONST NumericStrFld = 4 Numeric string
CONST NotesFld = 5 Notes (multi-line text)
CONST ScrollFld = 6 Scrolling text (single-line)
CONST LogicalFld = 7 Logical
CONST IntFld = 8 Integer
CONST LonglntFld = 9 Long integer
CONST SngFld = 10 Single precision
CONST DblFld = 11 Double precision
CONST MoneyFld = 12 Currency
I CONST DateFld = 13
CONST EuroDateFld = 14
CONST PhoneFld = 15
CONST ZipFld = 16
CONST SoSecFld = 17
CONST Relational = 18
CONST MultChAFld = 19
US date
European date
Telephone number
Zip code
Social security number
Relational
Multiple choice array
CONST MouseFld = 20 Mouse field
CONST PButton = 21 Push button
CONST HScrollFld = 22 Horizontal scroll bar
CONST VScrollFld = 23 Vertical scroll bar
EDITFORM.BI
EDITFORM.BI contains constant assignments and the user-defined TYPE
FormlnfoG which is constructed as follows:
TYPE ForminfoG
StartEl AS INTEGER
FldNo AS INTEGER
PrevFld AS INTEGER
FldEdited AS INTEGER
KeyCode AS INTEGER
TxtPos AS INTEGER
InsStat AS INTEGER
Presses AS INTEGER
MRow AS INTEGER
MCol AS INTEGER
Button AS INTEGER
Mx AS INTEGER
My AS INTEGER
DoingMult AS INTEGER
Edited AS INTEGER
END TYPE
The FormlnfoG TYPE elements are explained in Table 21. You will use
the following statement to create the Frm TYPE variable:
DIM Frm as ForminfoG
The Frm TYPE variable is used by a calling program to set the current
field to be edited, to examine the last key pressed, to toggle the insert
status of the forms editor and to determine when data in a form has been
altered.
This last item, Edited, because it lets you know if any of the information
on the form has been changed. Each time you update a record in the file
you should set Frm.Edited to 0. Then, if any field values are changed,
Frm.Edited will be set to -1, letting you know that it is necessary to write
■
the form record to the file again.
You may read or set any of the Frm TYPE elements in your program.
However the elements Presses, Mx, My, MRow, and MCol should only
be read-altering them will have no affect on the form.
I
page)
I CalcFields
Tokenize
Recalculates dependent fields based on a given
field
■
Method Module(sl You Call
Display Screens GDISPLAYBAS ShowForm
(.PCX)
(.PCX in .GSL Library) LIBFILE.BAS LibShowForm
Screen Files (.GMP) GETGMP.BAS GetGMP
(.GMP in .GSL library) LIB FIi LE.BAS LibGetGMP
Form Files FRMFILE.BAS NumFieldsG
(.FRM) GetFldDefG
(.FRM in .GSL library) LIBFILE.BAS LibNumFieldSG
LibGetFldDefG
Perform Data Entry EDITFDRM.BAS Ed~FormG
Form Files MYFORM.BAS MyForm
.BAS EDITFDRM.BAS EditFormG
Table 23 lists the files needed for certain key Graphics QuickScreen
features as well as the equivalent files that remove those features when
they are not needed. Please understand that one of these files is needed to
successfully link your program. For example, if you need the calculated
fields feature in a program that you are writing, then you must compile
the GQSCALCG.BAS and link that with your main program. Otherwise,
you should compile the NOCALCG.BAS "stub" file and link that with
your program instead.
Note that no harm is done if you use the full-featured version of a file,
even when a particular feature is not needed. However, your final .EXE
program will be larger than necessary because code that is not needed is
added to it.
Calculated Fields:
GQSCALC.BAS (For support)
NOCALCG.BAS (To remove support)
Multiple Choice Fields:
LISTBOX.BAS (For support)
NOMULTG.BAS (To remove support)
Multi-Line Notes Fields:
GQEDITS.BAS (For support)
NONOfES.BAS (To remove support)
Scroll Bars:
SCROLLB.BAS (For support)
NOSCROLB.BAS (To remove support)
I
Scrolling Text Fields:
SCROLLIN.BAS (For support)
NOSCRO'-L.BAS (To remove support)
There are a number of BASIC and assembler subroutines that you may
call from your programs. The following pages present an alphabetic
summary of these routines. Each routine is discussed separately and we
have provided information about its program type (subroutine or function),
purpose, and calling syntax.
BCopy
assembler subroutine contained in GFORMS.LIB
■ Purpose
BCopy copies of a block of memory (up to 64K in size) to a new location.
It is used primarily to copy information from Form$(0, 0) to a TYPE
structure.
■ Syntax
CALL BCopy(FromSeg%, FromAddr%, ToSeg%, ToAddr%,
NumBytes%, Direction%)
■ Where
FromSeg%: Segment of the source location of the block
■
NumBytes % : Number of bytes to be copied
CalcFields
BASIC subroutine contained in GQSCALC.BAS
■ Purpose
CalcFields is used to recalculate a field which is dependent upon other
field values.
■ Syntax
CALL CalcFields(StartOfForm%, FldNo%, Form$(),
Fld() AS FieldinfoG)
■ Where
StartOfForm % : Start of the form, equal to Ofor single-page forms; for
multi-page forms, this number is equal to the offset in
the Fld0 TYPE array needed to point to first field of
the desired form
I ■
Fld():
Comments
Field information TYPE array (see FWINFO.Bl)
Date2Num
assembler function contained in GFORMS.LIB
■ Purpose
Date2Num converts a date in string form to an equivalent integer variable.
■ Syntax
Days%= Date2Num%(D$)
■ Where:
Days%: The number of days before or after 12/31/79, and D$
is a date in the form "MMDDYY" or "MM-DD-YY"
or "MM/DD/YYYY", or any similar combination
■ Comments
Because Date2Num has been defined as a function, it must be declared
before it may be used.
■
to only two bytes, it also provides an easy way to perform date arithmetic.
Date2Num will operate on any date that is within the range 01-01-1900
to 11-17-2065. Invalid dates that fall outside of that range will return
-32768 to indicate an error.
Example
I
Once a date has been converted to the equivalent integer value, you may
add or subtract a number of days, and then use the companion function
Num2Date to convert the result. The example below shows this in context.
DEFINT A-Z
DECLARE FUNCTION Date2Num(X$)
DECLARE FUNCTION Num2Date(Dat)
D$ = "09-17-88"
Start= Date2Num(D$)
Later= Start+ 30
After30 = Num2Date$(Later)
PRINT "Thirty days after "; D$; " is "; After30
Because Date2Num and Num2Date are set up as functions they may also
be used within a print statement directly, along with optional calculations:
PRINT "30 days after "; D$; " is "; Num2Date$_
(Start+ 30)
Date2Num and Num2Date are also useful for verifying if a given date is
valid, which eliminates tedious calculations that you would have to perform
to take possible leap years into consideration.
The only requirement for the date validation example below is that the
original date must be in the form MM-DD-YYYY, because this is the
format returned by Num2Date.
DEFINT A-Z
DECLARE FUNCTION Date2Num%(X$)
DECLARE FUNCTION Num2Date%(Dat)
INPUT "Enter a date in the form MM-DD-YYYY: "; D$
Oat= Date2Num%(D$)
IF Num2Date$(Dat) = D$ THEN
PRINT D$; " is a good date!"
ELSE
PRINT "Please try again."
END IF
This program asks for an original date and then converts it to an equivalent
number. If after converting it back to a string the result is the same, then
the date that was entered is valid.
DispPCXVE
assembler subroutine contained in GFORMS.LIB
■ Purpose
DispPCXVE continues the loading process started by OpenPCXFile% and
displays the image to a VGA or EGA specified video page.
■ Syntax
CALL DispPCXVE (BYVAL VideoPage%)
■ Where
Video Page%: 0 for the default first display page (Visual Display
Page); a value of I specifies the second display page
■ Comments
The parameter for this routine is passed by value to provide the maximum
speed.
EditFormG
BASIC subroutine contained in EDITFORM.BAS
■ Purpose
EditFormG is the core data entry routine that handles all user input, cursor,
and mouse activity when processing forms. This routine is pollable so
the calling routine can monitor user input as it occurs.
■ Syntax
CALL EditForrnG(Forrn$(), Fld(), Frrn, Action\)
■ Where
Form$(): Form string array (see Form$() array)
I ■ Comments
The EditFormG suhprogram is a major routine in Graphics QuickScreen.
It will allow calling programs to process forms, making additional
programming virtually unnecessary.
Once the form arrays are properly sized, they can be initialized and loaded
using the GetFldDefG routine:
CALL GetFldDefG(FrrnNarne$, StartE1%, Fld(), Form$())
To continue with the list, Frm is a TYPE variable which is DIMed to the
FormlnfoG user-defined TYPE (please see EDIIFORM.Bl).
ACTION= 1
DO
CALL EditForrnG(Forrn$(), Fld(), Frrn, Action)
LOOP UNTIL Frrn.KeyCode = 27 'Keep editing until
' user presses Esc
When the user finally presses Esc, the data entered into the form may be
I
accessed by examining the contents of the Form$0 string array.
EndOfForms
BASIC function contained in EDITFORM.BAS
■ Purpose
EndOfForms returns the number of the last field on any form.
■ Syntax
LastFld% EndOfForrns%(Fld())
■ Where
LastFld%: The value of the last field on the form
This function can be used to determine the last field number on a form,
and is particularly useful for a multi-page forms.
Evaluate
BASIC function contained in EVALUATE.BAS
■ Purpose
Evaluate is a full-featured expression evaluator that accepts a formula in
an incoming string, and returns a double-precision result. Capitalization
is ignored (in keywords such as LOG and SIN), except for the "E" used
for scientific notation: to Evaluate, a lowercase "e" represents the
constant, and an uppercase "E" is for the exponent.
■ Syntax
Answer#= Evaluate#(Expression$)
■ Where
Expression$: A string containing a mathematical expression, with
optional parentheses, operation keywords (such as ABS
or SIN), and numbers; if the string expression is
invalid, the string is returned in Expression$ with a
leading percent sign(%) appended
■
Answer#:
Comments
Receives the computed answer
COT Cotangent
csc Cosecant
CSCH Hyperbolic Cosecant
EXP Exp
LOG Natural Log (base e, what
BASIC calls LOG)
NOT Logical NOT
OR Logical OR
SINH Hyperbolic Sine
SECH Hyperbolic Secant
SEC Secant
SIN Sine
SQR Square Root
TAN Tangent
TANH Hyperbolic Tangent
Factorial
Exponentiation
I *
+
MultiplicationR
Division
Integer Division
Addition
Subtraction (or unary
minus, such as -15)
< Less than
Equal to
> Greater than
■ Example
X = EVALUATE("l0 * (12'3+(4E-13))/LOG(8)")
Exist
assembler function contained in GFORMS.LIB
■ Purpose
Exist will quickly determine the presence of a file.
■ Syntax
There%= Exist%(FileName$)
■ Where
FileName$: File name or file specification
The main purpose of Exist is to prevent the error caused by trying to open
■
a file for input when it does not exist. Rather than having to set up an ON
ERROR trap just prior to each attempt to open a file, Exist will directly
tell if the file is present.
In the past, programmers have tried to avoid an error by opening a file for
random access, which does not cause an error. Then the BASIC LOF
function would be used to see if the file's length is zero, meaning it was
not there. The problem with that approach, besides being a lot of extra
work-is that an empty file could be created in the process. For this
reason, we recommend using the Exist function.
There%= Exist%("B:\STUFF\*.BAS")
FGet
assembler subroutine contained in GFORMS.LIB
■ Purpose
FGet reads data from a disk file in a manner similar to BASIC's binary
GET command, but it returns an error code rather than requiring the use
of ON ERROR.
■ Syntax
CALL FGet(Handle%, Destination$)
■ Where
Handle%: Handle assigned when the file was opened
Only two errors are likely when using FGet: either the DOS handle number
was invalid, or the destination string was null.
■ Example
This example gets one byte of information from the current file, at the
location specified by the DOS file pointer.
XS= SPACE$(1) "set one byte aside
CALL FGet (Handle%, XS) 'read the byte value from .
' the file
FixDate
BASIC subroutine contained in EDITFORM.BAS
■ Purpose
FixDate changes the format of a date string.
■ Syntax
CALL FixDate(Dat$)
■ Where
Oat$: String containing the date in a variety of string formats
■ Comments
This subprogram ensures that dates are formatted in a consistent manner.
For instance, FixDate forces all months and days to have two numerical
digits (single-digit months or days will have a leading zero). It also ensures
that a century is entered as two digits. Thus, "3-4-91" will become
"03-04-1991" after calling FixDate.
■ Example
I
CALL FixDate(Dat$)
FldNum
BASIC function contained in EDITFORM.BAS
■ Purpose
FldNum returns the field number corresponding to a specified field name.
■ Syntax
FldNumber% = FldNurn%(FldName$, Fld())
■ Where
FldNumber%: Number of the field named by FldName$
I ■
FldNum makes it easy to obtain the number of a field if all you have
available is its name. The routine is useful for creating programs which
do not have to be rrodified as your data entry form changes. It also makes
source code more intelligible by allowing long variable names to refer to
short field names.
Example
This example finds which field is named "DIS CRATE" (the discount rate).
Then, the field number is used to obtain the value of a field.
DiscountRateFld = FldNurn(""DISCRATE"", Fld())
DiscountRate = VAL(Forrn$(DiscountRateFld, 0))
FOpen
assembler subroutine contained in GFORMS.LIB
■ Purpose
FOpen is used to open a disk file in preparation for reading or writing
using the FGet or FSeek routines.
■ Syntax
CALL FOpen(FileNarne$, Handle%)
■ Where
FileName$: Name of file to be opened
■
sure whether a file exists you should first use the Exist function.
It is up to your program to store the handle number that DOS assigns and
to use that handle whenever you access the file again.
Example
This example opens the file MYFORM.FRM and assigns an integer file
I
handle number to it.
CALL FOpen("MYFORM.FRM", Handle%)
GArraySize
BASIC function contained in GARRAYSZ.BAS
■ Purpose
GArraySize returns the number of bytes required by BASIC's graphic GET
statement to hold a specified region of the screen.
■ Syntax
Size&= GArraySize&(Xl, Yl, X2, Y2)
■ Where
Xl and YI define the upper-left corner and X2 and Y2 define the lower
right corner of the region to be saved.
■ Comments
GArraySize& can be used in any BASIC supported graphics mode.
■ Example
GetFldDefG
BASIC subroutine contained in FRMFILE.BAS
■ Purpose
GetFldDefG retrieves information from a form file and places it in a
structure for later reference by other routines. It also loads formulas and
help messages into the Form$0 data array.
■ Syntax
CALL GetFldDef(FrrnNarne$, StartE1%, Fld(), Form$())
■ Where
FrmName$: Name of the form (.FRM) definition file
I
Form$(): Form string array (see Form$() array)
■ Comments
This routine allows a calling program to load a .FRM file so that it may
be properly processed by EditFormG. The NumFieldsG function should
be used before this routine in order to properly dimension the Fld() and
Form$() arrays.
■ Example
An example of this routine is shown in the section DemoAnyG. BAS under
Performing Data Entry.
GetGMP
BASIC subroutine contained in GETGMP.BAS
■ Purpose
GetGMP loads .GMP image files from disk into an array.
■ Syntax
GetGMP(Narne$, GMPFile$, Array%(), Errcode%)
■ Where
GMPFile$: The name of the GMP file to display; the GMP
extension is not required
I
that the file was not found
■ Comments
GetGMP lets you display .GMP files created with the Save Paste Buff...
option from the File menu from your own programs.
■ Example
Before calling the GetGMP subroutine, you must first create an ArrayO
to hold the image:
REDIM Array(0)
CALL GetGMP("Pencil", Array(), ErrCode)
After the image is loaded, it can be placed anywhere on the screen with
BASIC's graphic PUT command:
PUT (10, 10), Array, PSET
GetRec
BASIC subroutine contained in RANDOMG.BAS
■ Purpose
GetRec retrieves a specified record and any associated notes from a
database.
■ Syntax
CALL GetRec(RecNo&, Form$(), Fld())
■ Where
RecNo&: Record number to retrieve
GMove2VE
assembler subroutine contained in GFORMS.LIB
■ Purpose
GMove2VE will save and restore any rectangular region of the screen to
a video memory location which you specify.
■ Syntax
DestSegment% = &HA800
CALL GMove2VE (BYVAL FromCol%, BYVAL FromLine%
BYVAL Cols\, BYVAL Lines%, BYVAL DestSegment%~
BYVAL Direction\)
■ Where
FromCol % : The upper left column (in text columns) of the region
to be moved
FromLine%: The upper left row (in pixels) of the region to be moved
All parameters for th is routine are passed by value to provide the maximum
speed.
■ Example
The following example saves and restores the upper-left comer 10 column
by 100 lines region of the screen.
DEFINT A-Z
DECLARE SUB GMove2VE (BYVAL FromCol%, BYVAL _
The VGA high-resolution mode doesn't have a second screen per se, but
you still can use this routine. For the VGA, the first unused graphics
segment would be &HAA00 as shown in the above code example. The
VGA has only 96K available memory for the storage of images.
The following formula will help to calculate the amount of memory used
by an image saved with this routine:
MemUsed% =Cols%* Lines%* 4
To determine the next segment where graphics images can be stored, use
I
NextSegment% = ThisSegment& + MemUsed% \ 16 + 1
This routine is a vital part of saving graphics images for use in the graphics
GQSMenu menu and in the ListBox routine.
GMove4VE
assembler subroutine contained in GFORMS.LIB
■ Purpose
GMove4VE will save and restore any rectangular region of the screen to
an array you specify.
■ Syntax
CALL GMove4VE (BYVAL FromCol%, BYVAL From Line%,
BYVAL Cols%, BYVAL Lines%, BYVAL DestSegrnent%,
BYVAL Direction%)
■ Where
FromCol % : The upper left column (in text columns) of the region
to be moved
FromLine%: The upper left row (in pixels) of the region to be moved
The memory location must be declared prior to saving the image into the
array. To calculate the amount of memory required use the following
formula:
MemoryNeeded% = Columnsused% • Linesused% • 4 + 4
Once the amount of memory required has been calculated, you will
dimension an integer array with half of the elements contained in Memory-
must then run BASIC with the / Ah parameter and compile your programs
with this parameter as well. In addition, you will need to create and pass
this routine a long integer array where each element will provide 4 bytes
of memory space. To make an array holding 128K of memory, dimension
it as follows:
REDIM LongArray&(O to 32767)
■ Example
The following example saves and restores a region 10 columns wide by
100 lines high in the upper-left hand corner of the screen.
DEFINT A-Z
DECLARE SUB GMove4VE(BYVAL Col, BYVAL ScrnLine,
BYVAL Cols, BYVAL DestSegment, BYVAL Direction)
SCREEN 12 'sets the monitor in VGA mode
LINE (0,0)-(79,99), 1 B
'save the image
MemNeeded% = 10• 100 • 4 + 4
DIM A%(MemNeeded% \2) 'each integer counts for 2
bytes
CALL GMove4VE(l,O, 10, 100, VARSEG(A%(0)), ))
I
WHILE INKEY$ = "":WEND
CLS
'restore the image
CALL GMove4VE (1, 0, 10, 100 VARSEG(A%(0)), -1)
GPrintOVE
assembler subroutine contained in GFORMS.LIB
■ Purpose
GPrint0VE prints a string on the 16-color EGA and VGA high-resolution
graphics screens in a specified color.
■ Syntax
CALL GPrintOVE (BYVAL Row%, BYVAL Column%, Text$,
BYVAL TextColor%)
■ Where
Row% The normal coordinates used by the BASIC LOCATE
and Column%: statement
I ■
TextColor% =Foreground%+ (Background* 256)
Comments
Numeric parameters for this routine are passed by value to provide the
maximum speed.
■ Example
The following example shows how to print a string to the VGA using the
color blue for the foreground, and the color gray for the background.
DEFINT A-Z
DECLARE SUB GPrintOVE (BYVAL Row, BYVAL Col, BYVAL
Column, Text$, BYVAL TextColor)
SCREEN 12 'sets the monitor in
VGA mode
This routine is many times faster than the BASIC PRINT statement. It
also allows you to specify a background color for the text string.
HideCursor
assembler subroutine contained in GFORMS.LIB
■ Purpose
HideCursor turns off the mouse cursor.
■ Syntax
CALL HideCursor
■ Comments
Any program that is to be "mouse aware" will need to turn on the mouse
cursor before expecting a user to access the mouse. Likewise, it is only
common courtesy to turn it off again before returning them to the DOS
prompt. Also, for graphics programming, you must turn the mouse off
before drawing something on the screen.
I
BASIC LOCATE command, the mouse cursor keeps track of how many
times it was turned on or off. Thus, if you call HideCursor twice in a row,
you will need to call ShowCursor twice before it will be visible again.
In graphics mode, when you want to draw something at the location of the
mouse, it is necessary to turn off the mouse cursor temporarily while you
are drawing. In graphics mode, the mouse has a copy of the screen image
beneath itself. If you draw over the cursor with the cursor on, when the
cursor moves, the mouse driver will re-draw the previous image, without
what you drew.
This is why you see the mouse flicker in large graphics applications. These
applications turn the mouse off and on many times while drawing to the
screen. It is for this reason that the above mentioned characteristic of the
HideCursor routine can be useful. If you have multiple routines drawing
graphics on the screen, it is necessary that each routine turn the mouse
cursor off before drawing and turn it back on before leaving. However,
due to the nature of graphics programming, a routine cannot always expect
to be called from another routine which has previously turned off the
mouse. For example, a routine designed to draw an entire face might call
a routine to draw an eye. If the eye routine were to be called separate! y,
it should turn off the mouse cursor itself. If it is called from within another
routine which has already turned off the cursor, then it should not turn on
the cursor when it is finished. Instead the count maintained by the mouse
lnitMouse
assembler subroutine contained in GFORMS.LIB
■ Purpose
InitMouse is used to determine if a mouse if present in the host PC, and
to reset the mouse driver software to its default values.
■ Syntax
CALL InitMouse(HaveMouse\)
■ Where
HaveMouse%: Receives -1 if a mouse is present, or O if no mouse is
installed
■ Comments
Because InitMouse resets the mouse driver values (the mouse cursor color,
its travel range and sensitivity, etc.), it would probably be called only once
at the start of a program.
KeyDown
assembler function contained in GFORMS.LIB
■ Purpose
KeyDown reports if any keys are currently being pressed.
■ Syntax
KeyisDown = KeyDown%
■ Where
KeyisDown: Returns -1 (True) if a key is currently being pressed,
or 0 if no keys are pressed
■ Comments
Because KeyDown has been designed as a function, it must be declared
before it may be used. KeyDown must also be installed before it will
operate, and this is done by calling the InstallKeyDown routine.
In order to detect when keys are pressed and released, KeyDown takes
over the keyboard interrupt. This is why it must be installed. KeyDown
automatically removes itself from the interrupt chain automatically when
your program ends.
However, a bug in QBX (the QB editor that comes with BASIC 7 PDS)
prevents the automatic de-installation from working correctly. Therefore,
you must call DeinstallKeyDown manually before ending your program if
you are using QBX. De-installing is not necessary with QuickBASIC 4.0
or 4.5, nor with programs that are compiled to .EXE files.
Note that when multiple keys are pressed (such as Alt-F), Keydown returns
-I when Alt is first pressed. But as soon as either combination key is
released KeyDown returns 0.
■ Example
See EditFormG for an example of using Key Down.
LibGetFldDefG
BASIC subroutine contained in LIBFILE.BAS
■ Purpose
LibGetFldDefG retrieves information from a form file contained in a
custom .GSL library and places it in a structure for later reference by other
routines. It also loads formulas and help messages into the Form$O data
array.
■ Syntax
CALL LibGetFldDef(LibName$, FrmName$, StartE1%,
Fld(), Form$(), ErrCode%)
■ Where
LibName$: Name of the custom .GSL library; the .GSL extension
is assumed and does not need to be entered
■
StartE1%: Starting element in the FldO array in which the form
information is to be loaded
LibGetGMP
BASIC subroutine contained in LIBFILE.BAS
■ Purpose
LibGetGMP loads .GMP files from a custom .GSL library into an array.
■ Syntax
LibGetGMP(LibName$, GMPFile$, Array%(), ErrCode%)
■ Where
LibName$: Name of the GSL library; the .GSL extension is
assumed and does not need to be entered
I ■ Comments
was loaded successfully; a value > I indicates that an
error occurred opening the library file; a value of 1
indicates that the file was not found in the specified
library
After the image is loaded, it can be placed anywhere on the screen with
BASJC's graphic PUT command:
PUT (10, 10), Array, PSET
LibNumFieldsG
BASIC function contained in LIBFILE.BAS
■ Purpose
LibNumFieldsG returns the number of fields in a form contained in a
custom .GSL library.
■ Syntax
N% = LibNumFieldsG%(LibName$, FormName$)
■ Where
LibName$: Name of the GSL library; the .GSL extension is
assumed and does not need to be entered
FormName$: String containing the full path and file name of the form
definition file; the . FRM extension must be included
I
■ Comments
LibNumFieldsG is used to replace the NumFieldsG function when the
form definition file is stored in a custom . GSL library. Note that the calling
syntax for LibNumFieldsG is identical to that used by NumFieldsG except
for the addition of the LibNames$ argument and the need to include the
.FRM extension in FormName$.
LibShowForm
BASIC subprogram contained in LIBFILE.BAS
■ Purpose:
LibShowForm displays any .PCX screen that you design with the Graphics
QuickScreen screen editor and is stored in a custom .GSL library. It sets
the proper screen mode, number of text rows, and adjusts the color palette.
The row and column arguments allow you to position partial screen images.
■ Syntax:
Call LibShowForm (LibName$, FileName$, Fld(),
Row%, Col%, VPage%, ErrCode%)
■ Where:
LibName$: The name of the custom .GSL library; the .GSL
extension is assumed and does not need to be entered
If you are repositioning a partial .PCX image that has field definitions,
the Fld(N).Row, Fld(N).LCol, Fld(N).RCol, and Fld(N).ScratchI vari-
ables are automatically updated for each field to their new coordinates.
Row: The Y screen coordinate (in pixels) for the upper left
corner of a partial screen; any valid screen row may be
specified as long as the bottom-most field is fully
displayed; to display a full screen image set this value
to 0
I
of 4 indicates that an error occurred while loading the
screen.
■ Example
This example displays the "Screen! .PCX" image stored in "Cus-
tom.GSL".
CALL LIBShowForm("Custom", "Screenl.PCX",
Fld(), O, O, O, ErrCode'ii)
ListBox
BASIC subroutine contained in LISTBOX.BAS
■ Purpose
ListBox is a comprehensive menu subprogram with many importan,
capabilities including full support for a mouse. It can optionally save t.'le
underlying screen to conventional or video memory. If there are more
choices than can be displayed in the specified number of rows, a scroll
bar will be added to the menu. ListBox is used to support multiple-choice
fields in a form and is also used in the Graphics QuickScreen File Open ...
dialog box.
■ Syntax
CALL ListBox(Itern$(), Choice%, MaxLen%, Rows%, Ky$,
Hk% (), Action%)
■ Where
Item$: Conventional (not fixed-length) string array containing
the list of menu choices.
Choice%:
MaxLen%:
Indicates which choice was selected, and may also be
pre-loaded to force a given choice to be highlighted
initially
Ky$: Holds the last key that was pressed by the user
The Action variable has nine different possible settings that tell ListBox
how it is to behave. Each of the possible Action values is described below.
If Action is set to zero, then the menus will operate the way you would
expect a "normal" menu to work. That is, the menu is displayed, and an
INKEY$ loop repeatedly waits for the user to press a key or a mouse
button. Once a key or mouse button has been pressed, control is returned
to the calling program. The Choice variable may then be examined to see
what selection the user chose.
When Action is set to -3, ListBox simply displays the menu without
highlighting a choice and returns control immediately to the calling
program.
When Action is set to -2, -1, or I, ListBox displays the menu and highlights
the specified choice. Action set to -1 first saves the underlying screen to
conventional memory while Action -2 saves the screen to video memory.
Action set to I does not save the underlying screen. Control is returned
to the calling program immediately, however Action is set to 3 for
subsequent calls. Since Action set to 3 is how you will be polling the menu
subsequently, this saves you an extra step.
Setting Action to 2 lets you redisplay the menu, in those cases where you
I may wish to change the contents of the menu without having to first exit
ListBox and call it again with the new selections. Action 2 also resets
itself to 3 for subsequent calls. If the menus are called with Action equal
to 3, the keyboard and mouse are merely polled to see if a key or button
has been pressed.
If Action is still set to 3 when the menu returns, it means that no keys or
mouse buttons were pressed.
If Action is set to 5, List Box will remove itself and restore the original
screen if it had been called initially with Action = -1 or Action = -2.
If you are not using multiple-choice fields you should use the "blank"
ListBox subprogram which is part of NOMULTG.BAS. This resolves
references to ListBox without needing to load the full ListBox source code.
Message
BASIC subprogram contained in FORMEDIT.BAS
■ Purpose
Message displays text messages in a box
■ Syntax
CALL Meeeage(Msg$, Row)
■ Where
Msg$: Message string
Colors for the various components of the message box are set in GPDat% O
elements 96 - 99:
I
GPDat%(96) = Background color 'Default = 7 gray
GPDat%(97) = Text color 'Default = 0 black
GPDat %(98) = Highlight color 'Default = 15 white
GPDat%(99) = Shade color 'Default = 8 Dk.gray
Motion
assembler subroutine contained in GFORMS.LIB
■ Purpose
Motion allows a program to establish the sensitivity of the mouse cursor
motion.
■ Syntax
CALL Motion(Value%)
■ Where
Value%: The desired sensitivity ranging between I and 32767,
with I being the most sensitive
■ Comments
Even though the mouse driver software allows setting the horizontal and
vertical sensitivity separately, Motion uses the same value for both. This
seems to be the most logical way to control a mouse, while eliminating
yet another passed parameter.
I The stated upper range for the motion sensitivity is 32767, however values
beyond 100 or so are hopelessly insensitive.
You may be interested to know that Microsoft calls the unit of cursor
distance for the mouse a "Mickey".
MultMonitor
assembler function contained in GFORMS.LIB
■ Purpose
MultMonitor% makes it east to determine the type of display adapter
currently active.
■ Syntax
M% = MultMonitor%
■ Where
MonType%: Integer value representing the detected monitor type
currently in use; a value ofO means no graphics monitor
is attached.
I
3 8 color EGA adaptor is attached
4 16 mono VGA adaptor is attached
5 32 color VGA adaptor is attached
6 64 mono MCGA adaptor is attached
7 128 color MCGA adaptor is attached
8 256 EGA adaptor emulating CGA
9 512 IBM 8514/A adaptor is attached
For example, a system which has both a VGA color monitor and a Hercules
monitor connected will return a value of33 (32 for VGA + I for Hercules).
■ Comments
To check if a VGA monitor exists, use the following line of code:
IF (M% AND 32) <> 0 THEN PRINT "Can use VGA"
■ Example
See SETUP.BAS for an example of using MultMonitor.
NumFieldsG
BASIC function contained in FRMFILE.BAS
■ Purpose
NumFieldsG returns the number of fields in a form.
■ Syntax
N% = NumFieldsG%(FormNameS)
■ Where
N %: Number of fields in Form Name$
Form Name$: String containing the full path and file name of the form
■ Comments
Because NumFieldsG has been defined as a function, it must be declared
before it may be used.
This function is used to dimension the FldQ TYPE array and Form$ data
array to the proper number of elements before calling GetFldDefG.
I ■ Example
This example retuF1s the number of fields in the MYFORM.FRM file:
NumFields% = NumFieldsG%("MYFORM.FRM")
Num2Date
assembler function contained in GFORMS.LIB
■ Purpose
Num2Date converts a previously-encoded integer date to an equivalent
date string.
■ Syntax
D$ = Num2Date$(Days%)
■ Where
D$: Formatted date string (MM-DD-YYY)
Please see the Date2Num discussion and example for more information.
OpenFiles
BASIC subprogram contained in RANDOMG.BAS
■ Purpose
OpenFiles is used to open a random access database (.DAT) file, and
field-format it to the data buffer Form$(0, 0). If there are multi-line notes
fields contained in the form, a Notes database file (.NCJf) is also opened.
■ Syntax
CALL OpenFiles(ForrnNarne$, Form$(), Fld() AS
FieldinfoG)
■ Where
FormName$: Base name of the database file to open (without the
.DAT extension)
I
■ Comments
OpenFiles looks in the current directory for the form name you provide.
If you want to acce,s files on a different drive or directory, then you must
append the path in front of the FormName$.
If the form is found, it and its associated notes file are opened; if the form
file is not found then it is created.
Once the random file is open, Form$(0, 0) is fielded to match the fields
as needed. Fld(0).Re!Handle holds the handle for the .DAT file that was
opened, and Fld(0).ScratchI hold the handle for the Notes file if one was
opened.
The GetRec and SaveRec routines can be used after OpenFiles has been
successful.
OpenPCXFile
assembler subroutine contained in GFORMS.LIB
■ Purpose
OpenPCXFile % opens the specified PCX file, and loads the header
information, including palette information, into the string specified.
■ Syntax
Array$= SPACE$(68 + 768)
Success% OpenPCXFile%(Filename$, Array$)
■ Where
Filename$: A string containing the name of the PCX file
I
■ Comment
After opening the PCX file, the image can be displayed by calling
DISPPCXVE:
Position PCXVE
assembler subroutine contained in GFORMS.LIB
■ Purpose
PositionPCXVE is used to locate a .PCX image which is loaded with the
DispPCXVE routine. By calling this routine immediately prior to the
DispPCXVE routine, a PCX image can be located at any column and line
combination as defined by the Mixed coordinate system.
■ Syntax
CALL PositionPCXVE (BYVAL Linestart%, BYVAL
Co1Start%)
■ Where
LineStart%: Upper-left row where the image is to be displayed (in
pixels)
I
■ Comments
This routine is used in ShowForm to display partial PCX images.
■ Example
See Show Form for an example of using PositionPCXVE
PrintArray
BASIC subprogram contained in EDITFORM.BAS
■ Purpose
PrintArray refreshes the screen by redisplaying the contents of fields in
the form.
■ Syntax
CALL PrintArray(FirstFld%, LastFld%, Form$(), Fld())
■ Where
FirstFld %: Starting field to be redisplayed
■
Sometimes it is necessary to alter the contents of a field manually in a
program. Refreshing the screen ensures that the user is aware of the new
contents of each field on the form.
Example
This example refreshes only the third and fourth field of the currently-dis-
played form:
I
CALL PrintArray(3, 4, Form$(), Fld())
QEdit
BASIC subprogram contained in GQEDITS.BAS
■ Purpose
QEdit is a graphics mode text editor subprogram that may be called as a
pop-up from within a BASIC program.
■ Syntax
CALL GQEdit(ArrayS(), Ky$, Action%, Ed)
■ Where
Array$O: Conventional (not fixed-length) string array that will
hold the text being entered or edited
I
Ed: TYPE variable that controls QEdit (see comments
below)
■ Comments
The QEdit editing window may be positioned anywhere on the screen, and
sized to nearly any number of rows and columns. QEdit can optionally
save the underlying screen and it may be used in the 25-, 30-, 43-, or
60-line screen modes. QEdit also supports word-wrap, a mouse, and
horizontal/vertical scrolling.
All of the standard editing keys are supported. For example, Home and
End move to the beginning and end of a line; the PgUp and PgDn scroll
the screen by pages; and Ctrl-PgUp and Ctrl-PgDn move to the first and
last lines, respectively. The cursor may also be moved to the top or bottom
of the edit window with the Ctrl-Home and Ctrl-End keys.
Similar to the BASIC editor, QEdit uses the Ctrl-Left and Ctrl-Right arrow
keys to move the cursor by words and Ctrl-Y to delete a line of text.
The call for QEdit is fairly simple to set up. Your program will need to
dimension a conventional (not fixed-length) string array to hold the lines
of text. The size to which the string array is dimensioned dictates the
maximum number of lines that may be entered.
The text may also be sent to QEdit as a single long line in the lowest array
element. In that case, it will be wrapped automatically before being
presented for editing. If you intend to read files prepared by a word
processor that places each paragraph on its own line (such as XyWrite),
you will probably want to read each line into every other element in the
string array. This will preserve the spacing between paragraphs, and can
be accomplished as shown below:
Like ListBox, the current cursor location indicates where to position the
upper-left corner of the editing window. Arguments passed to QEdit are
then used to indicate the width and height of the window, the margins,
colors, and so forth. Let's take a close look at each of these in turn. Here's
the QEdit calling syntax, once again:
I
CALL QEdit (Text$(), Ky$, Action%, Ed)
Ky$ returns the key holding the last key pressed. For example, it will
hold CHR$(27) if the user pressed Esc to exit QEdit.
The Action argument sets the operating mode for QEdit as follows:
Action = -2, -1, or I Initialize the editor for polled mode. The edit
window will be drawn, and the text (if any)
displayed. Control is returned to the caller
immediately without QEdit checking the key-
board. The Action flag is also set to 3 automat-
ically. Action values of -2 and - I first save the
underlying screen to either video or convention-
al memory* respectively.
Ed.Wide
lines before QEdit is called, then the window
may occupy up to 43 (for EGA) or 60 (for VGA)
lines.
I Ed.TL
Ed.CurLine
Holds the topmost row of the displayed text,
which will be greater than I if text has been
scrolled down.
Ed.UICRow
Ed.UlCCol
Ed.BrCRow
Ed.BrCCol These are not supported in this version
Ed.CBlock
Ed.MRow This holds the row where the mouse cursor was
at the time the button was last pressed or if it is
currently being pressed.
Ed.LCount
Ed.MErr
This holds the number of active lines in the text
string array, so you can know how many array
elements need to be written to disk when saving
text.
If you must save larger portions of the screen, you can call QEdit with
action set to -2 which saves the underlying screen in conventional memory.
Since the array that holds the underlying screen will in this case be greater
than 64k, you must start BASIC and compile your program with /ah.
SaveField
BASIC subprogram contained in EDITFORM.BAS
■ Purpose
SaveField validates and formats a field before placing it in the Form$(0,
0) form buffer. This routine is often used before calling the PrintArray
routine.
■ Syntax
CALL SaveField(FldNo%, Form$(), Fld(), BadFld%)
■ Where
FldNo%: Field to be examined
I
■ Comments
This routine first validates the data in the field by checking high and low
acceptable ranges for the data. If the data in the field is not valid (i.e., it
is out of the allowable range for the field, or it is an invalid date), then the
BadFld flag will be set to -1. If BadFld is returned as 0, then the data is
valid and SaveField will have updated the contents of the Form$(0, 0) form
buffer with the current field's data.
■ Example
This example validates data in field three before updating the field buffer:
CALL SaveField(3, Form$(), Fld(), BadFld%)
SaveRec
BASIC subprogram contained in RANDOMG.BAS
■ Purpose
SaveRec saves information from a form to a specified record in a .DAT
data file. Multi-line notes fields, if present, are written to a notes file
having a .Nor extension.
■ Syntax
CALL SaveRec(RecNo&, Form$(), Fld())
■ Where
RecNo&: Record number to save
I ■
random-access .DAT data file and any notes are saved to the .Nor notes
file. SaveRec is limited to one note field per form.
Scrollln
BASIC subprogram contained in SCROLLIN.BAS
■ Purpose:
Scroll in is a pollable virtual field input routine that allows editing text that
is wider than the window showing on the screen.
■ Syntax:
CALL Scrollln(Edit$, Scroll)
■ Where:
Edit$: The string to be edited, and may range from I to 32000
characters in length
3 User defined*
I
Scroll. Action: Determines how Scrollin is to be invoked:
If the length of the text is greater than the size of the edit window, the text
may be scrolled right or left by using the standard cursor keys, or with
the mouse by holding the left mouse button down on the left-most or
right-most character in the edit window. All of the standard editing keys
are supported; in addition Alt-C clears the field and Alt-R restores the
field to its original contents.
If you do not require a mouse for your application, the block of mouse
code in SCROLLIN.BAS can easily be removed. Simply search for
"MMM" and remove code as the comments indicate.
For Scrollln to work properly, you must also include the SCROLL.BI
include file in whatever module calls Scrollln.
I
Setup
BASIC include file contained in SETUP.BAS
■ Purpose
SETUP.BAS is an include file that defines several arrays used by Graphics
QuickScreen routines as COMMON SHARED. It also detects the current
monitor type, initializes the mouse, and sets several of the global
GPDat%() array elements to their default values. (See appendix A for
more information on the GPDat%0 array.)
■ Syntax
'$INCLUDE: 'Setup.BAS'
■ Comments
SETUP.BAS includes the COMMON.BI include file which actually
dimensions the GPDat%0 and Choice$() arrays as COMMON SHARED.
SETUP.BAS then calls MultMonitor to determine the current monitor
type. The value returned by MultMonitor is assigned to GPDat(31).
Next, SETUP.BAS sets default color values in the GPDat% Oarray for the
I pop-up list box and scroll bar used for multiple choice fields. If a mouse
is detected, GPDat%(73) will be set to true (-1).
ShowCursor
assembler subroutine contained in GFORMS.LIB
■ Purpose
ShowCursor turns on the mouse cursor, making it visible. If the cursor is
currently visible, ShowCursor does nothing, and leaves the mouse cursor
visible.
■ Syntax
CALL ShowCursor
■ Comments
For more information see the comments that accompany the companion
routine HideCursor.
■ SeeAlso
HideCursor
Tokenize
BASIC subroutine contained in GQSCALC.BAS
■ Purpose
Tokenize replaces field names with a padded fixed-length (23-character)
string containing the field number.
■ Syntax
CALL Tokenize(Calc$, Fld())
■ Where
Cale$: Formula string
UnPackBuffer
BASIC subroutine contained in EDITFORM.BAS
■ Purpose
UnPackBuffer copies and formats information contained in the form array
Form$(0, 0) and fills the Form$(FldNo, I) data array for each field.
■ Syntax
CALL UnPackBuffer(FirstFld%, LastFld%, Form$(), Fld())
■ Where
FirstFld%: Starting field to be redisplayed
Value
BASIC function contained in EDITFORM.BAS
■ Purpose
Value returns the value of a numeric string.
■ Syntax
StringValue# = Value#(NumStringS, ErrorCode\)
■ Where
NumString$: Numeric string
I ■
number. The numeric string can contain such characters as dollar signs,
commas, exponent signs, and so on. If an overflow occurred when the
string was being ccnverted to a number, then the ErrorCode value will be
-1; otherwise it will be 0.
Example
This example extracts the value 5000 from the string "$5,000":
StringValue# = Value#("SS,000",Errorcode\)
WholeWord In
BASIC subroutine contained in GQSCALC.BAS
■ Purpose
WholeWorldln locates a substring within a string, using math operators
as delimiters.
■ Syntax
CALL WholeWordin(Text$, Word$)
■ Where
Text$: String to be searched
I
-
I
-
Graphics QuickScrcen Developing in the QB/QBX Environment
Whether you are using QuickBASIC or the QBX editor that comes with
Microsoft BASIC Professional Development System, you'll need to make
certain environment variables and library routines available to the compiler
environment. The steps needed to prepare the environment properly are
summarized below.
2. If you want to create .EXE files from within the environment, you
should place all . LIB files in the same directory. Then, make sure
that the LIB environment variable is set to the correct directory
path. If the linker cannot locate needed .LIB files, it usually
generates an "Unresolved external reference" error.
Environment variables are usually set from a batch file or directly at the
DOS prompt. The suggested method, however, is to add such commands
to your system's AUTOEXEC.BAT file. This way, environment informa-
I
tion will be established each time the computer is booted.
.
If you prefer, you can create a batch file in your Graphics QuickScreen
directory which you can run before your Graphics QuickScreen sessions.
An example SET command is:
SET LIB=C:\QB\LIBS
Only one Quick Library can be used, and it must be loaded when starting
BASIC. Furthermore, loading Quick Libraries in either QB or QBX
reduces the amount of conventional RAM available, so it is important to
keep such libraries as small as possible. We suggest using the MakeQLB
utility which we have included.
4. If you are using AJS Publishing's db/LIB® product, you can add it
to a Quick Library by specifying its . LIB file when using
MakeQLB.
or
QBX /L MYQLB
I
-
your BASIC source code, declare statements and calls for these subroutines
are automatically added to the code as required. If you generate your
source code from scratch, you will have to declare and call these routines
yourself. The syntax is very simple:
DECLARE SUB InstallKeyDown ()
DECLARE SUB DeinstallKeyDown ()
CALL InstallKeyDown
CALL DeinstallKeyDown
END
Install Key Down should be called anytime before calling EditFormG. The
DelnstallKeyDown subroutine should be called just before you end your
program. Key Down is called internally by EditFormG and therefore
requires no coding on your part.
When you are developing in the QB or QBX environments and break out
of your program, then re-start it, you will find that KeyDown no longer
Before calling one of these routines, the Fld0 TYPE array must first be
dimensioned and assigned. This is discussed in the section Assigning Field
Definitions. The Fld0 array is passed to the ShowForm routine to let it
change the fields coordinates when partial .PCX screens are repositioned,
and to tell it the number of screen rows to set.
The easiest way to display and edit your forms from a BASIC program is
I
to select (Compose Fields) Make Demo... . This will create a BASIC
source file that you can run from BASIC and will behave as if Try Data
Entry in Form had been selected. It will also setup appropriate SELECT
CASE statements to handle push buttons and scroll bars as well as generate
temporary choices for multiple choice fields.
A .MAK file is also created that contains all the required support modules
or stub files necessary to display and edit your forms. To run the demo,
exit Graphics QuickScreen and start QB or QBX with the appropriate
Quick Library (GForms.QLB or GForms7.QLB). Use the Open com-
mand from BASIC's File menu to select the demo. Once loaded, you may
run the demo by pressing Shirt-FS, assuming all of the files specified in
the .MAK file are in the current directory. This code serves as an excellent
starting point for creating your own source code .
.PCX screens that do contain any field definitions can also be displayed
by ShowForm, but in this case, you simply dimension the Fld0 TYPE
array to O before the call. In the case of display-only screens, the Fld0
array passes only two useful values to ShowForm. These are Fld(O). Value
and Fld(O).lndexed which tell ShowForm the correct screen mode and
number of text rows to set respectively. If these variables are set to 0,
ShowForm will use the current setting of GPDat%(31) to determine what
I
CALL ShowForm (FileName$, Fld(), Row, Column, VPage,
ErrorCode)
-
Here, Filename$ is the name of the . PCX file to display without an
extension.
Row is the screen row in pixels used to locate the top row of a partial .PCX
image. Since data entry fields must be located using standard text rows
and columns, the number used for the Row argument should be a value
that positions the image such that the fields will still fall on standard text
coordinates. The original row and column coordinates for the upper left
corner of partial .PCX images are stored in the form definition file.
Fld(0).Row holds the screen's upper row in pixels and Fld(0).LCol holds
the screen's left column. These values can be used to position a partial
image in its original position:
CALL ShowForm(FileName$, Fld(), Fld(O).Row,
Fld(O).LCol, VPage%, ErrorCode%)
Any other value can be assigned for the Row% and Col% parameters as
long as the entire form will still display. Showform will automatically
adjust an incorrect Row% value to the nearest pixel in order to maintain
proper alignment. This lets you enter just about any value for Row%, but
it does not necessarily place the image at the exact row specified. To
calculate the exact row, multiply the number of text rows to move by the
height of a standard text character (contained in the GPO at% (71) element).
Then add (or subtract) the result to the original row contained in
Fld(O).Row.
NewRow% = Fld(O!.Row + 5 * GPDat%(71)
CALL ShowForm(FileNarne$, NewRow%, Fld(O).LCol - 4,
VPage%, ErrorCode%)
This example places the image five text rows down and four columns to
the left of its original position.
Column indicates the left column (1-80) position of the partial .PCX
image.
The Row and Column parameters should be set to O when displaying full
screen images.
VPage indicates onto which video page the screen is to be loaded. The
default visible video page is 0. With this setting, you will see the image
wipe down the screen as it is loaded. Setting VPage to I will load the
screen into the second video page without displaying it. This lets you
display the screen with one of several wipe types discussed in the following
section. Since few VGA video adapters contain enough memory for more
than one 640x480 video page, the VPage parameter is ignored by VGA
screens.
The following example indicates the minimum code required for showing
a display-only screen.
DEFINT A-Z
DECLARE FUNCTION MultMonitor%
DECLARE SUB ShowForm (FormName$, Fld() AS ANY, Row,
Col, VPage, Errorcode)
'$INCLUDE: 'Fieldinf.Bi'
'$INCLUDE: 'Setup.BAS'
REDIM Fld(O) AS FieldinfoG
ShowForm "MyScreen", Fld(), O, O, 0, ErrorCode
To display an EGA screen with a wipe type, use a value of I for VPage
when calling ShowForm. This will load the screen into the non-visible
video page. You can then call the Wipes subroutine to display the image
I
with one of the available wipe types:
- VPage% = 1
CALL ShowForm(FileNameS, Row%, Column%, VPage%,
Errorcode%)
CALL Wipes(WipeType%)
WIPETI'PE EFFEf'T
Since you will probably use only a few of these wipes in a given
application, we suggest that you copy and paste only the ones you require
from the EGAWIPES.BAS module into your source code and then call
them directly. (Wipes is a BASIC subroutine contained in
EGAWIPES.BAS)
while loading the image from disk, Errcode% will be set to -1. Before
calling the GetGMP subroutine, you must create an array to hold the image
by redimensioning it to O elements:
REDIM Image%(0)
CALL GETGMP(Fi1eName$, Image%(), ErrCode%)
PUT (X, Y), Image%, PSET
If your program uses a mouse, you will need to turn off the mouse cursor
before displaying the image, and then turn it back on afterwards. This is
accomplished by calling HideCursor and ShowCursor respectively:
REDIM Image%(0)
CALL GETGMP(FileName$, Image%(), ErrCode%)
CALL HideCursor
PUT (X, Y), Image%, PSET
CALL ShowCursor
Once the image is loaded into the array, it can be placed at any X/Y position
using PUT as many times as you like. This is the technique used to place
icon images on the Graphics QuickScreen Drawing Palette. The coor-
dinates that you specify must place the entire image on the screen or BASIC
will issue an "Illegal Function Call" error. PUT can also display an image
using one of several display attributes: PSET, PRESET, AND, OR and
XOR. Consult yom BASIC manual for more information on effect of
these attributes.
I
- Storing .PCX, .FRM, and .GMP files in a .GSL library
When you distribute programs created with Graphics QuickScreen, you
must also supply the various screen (.PCX, .GMP) and form definition
files (.FRM) that they require. To avoid distributing many individual
screen and form definition files, you can combine your .PCX, .FRM and
.GMP files all into a single custom library. You then only have to distribute
a single library file along with your final .EXE.
To build the library file, you must first create a list file that identifies the
files you want to place in the library. The format of the list file is very
simple and can be created in any text editor that generates a pure ASCII
text file. (The BASIC editor works nicely). To create the list file, enter
each individual file name on its own 1ine and include the complete path if
the file is not located in the current directory:
C:\GQS\MyScreen.PCX
C:\GQS\MyScreen.FRM
C:\GQS\ICONS\MailBox.GMP
C:\GQS\InputBox.PCX
C:\GQS\InputBox.FRM
C:\GQS\MsgBox.PCX
Title.PCX
Save this file with a .LST extension. The name of the library that GQSLIB
creates will have the same name as your list file but with a .GSL (Graphics
QuickScreen Library) extension. The files may be listed in any order, and
you can have up to 500 different files in a single library.
To create the library, run the GQSLIB program and specify your list file
as a command line argument.
GQSLIB (Path]MyLib.LST
This example will create a library named MYLIB.GSL. If you later decide
to add or delete files from the library, simply edit your list file as required
and run GQSLIB again.
■
-
I
.
Graphics QuickScreen Performing Data Entry
General Concepts
When using Graphics QuickScreen, it is important to understand that the
screen image and a form with which it may be associated are separate files
and are therefore handled independently. In fact, data entry can still take
place even if the appropriate screen is not displayed. EditFormG simply
uses whatever colors it finds on the screen to use with the current form
definition file. Once a screen is displayed, forms can automatically direct
data entry activity.
Form data can be stored in a three different ways. The first is a standalone
file having the same name as the screen with which it is associated, but
with a .FRM extension. The second is a BASIC module that contains the
field assignments for your form. The third method stores the .FRM file
in a custom .GSL library file.
Data Entry
EditFormG is a BASIC subprogram which handles all aspects of data entry
in a form. It is used in a manner similar to INKEY$. Thus, EditFormG
continually polls for input while in a loop. While looping, a program can
perform other operations before and after each call to EditFormG. In this
manner you can achieve multi-tasking behavior.
General Procedures
The following section explains how to write code to set up and edit
Graphics QuickScreen forms in your BASIC programs. Remember that
this code can also be created automatically by selecting (Compose Fields)
Make Demo ... while still in the Graphics QuickScreen editor.
DemoAnyG.BAS
This program provides a good starting point for understanding how
Graphics QuickScreen forms are used from your own programs. Although
the source code is commented, you will find additional information here.
First, we suggest that you set all numeric variables to integers by default,
and that you declare the required BASIC and assembler routines-espe-
cially functions. These steps are accomplished as follows:
DEFINT A-Z
'-------- Declarations
DECLARE FUNCTION MultMonitor% ()
DECLARE FUNCTION NumFieldsG% (FormName$)
DECLARE SUB EditFormG (Form$(), Fld() AS ANY,
Frm AS ANY, Action)
DECLARE SUB GetFldDef (FormName$, StartE1%, Fld()
AS ANY, Form$())
DECLARE SUB ShowForm (ScreenName$, Fld(), Row%,
Col%, VPage% ErrCode%)
Next, you should load the necessary Include files at the beginning of your
programs. These files supply constant definitions and TYPE variables
that are needed by your programs.
The Include files required for this example are FLDINFO.BI (which
contains the FieldlnfoG TYPE and associated constants), EDITFORM.BI
(which contains the FormlnfoG TYPE and associated constants), and
SETUP.BAS. BASIC source code which Includes these files looks like:
'$INCLUDE: 'FLDINFO.BI'
I
'$INCLUDE: 'EDITFORM.BI'
'$INCLUDE: 'SETUP.BAS'
Before allocating memory to the arrays which are used to control the form,
it is necessary to determine the number of fields that are present. When
using standalone .FRM files (as in this example) you will need to use the
NumFieldsG function. This is demonstrated in the following excerpt:
NumFlds% = NumFieldsG(FormNameS)
The next step is to load the form definition file. Once again the routine
you'll use depends on how the form was stored. For standalone (.FRM)
files, you will need to use the GetFldDefG routine:
CALL GetFldDefG(FormNameS, Zero%, Fld(), Form$())
If you instead assign the form definitions from the BASIC subroutine use
this:
CALL MyProg(Fld(), Form$, Start%)
At this point, the form has been displayed and its field definitions loaded.
In order to allow input, the form has to be activated. This is done by
calling EditFormG with an Action of I, which sets up internal pointers
and displays initial field values from the Form$(N, 0) array elements.
Detailed Procedures
The prior section covered the fundamentals of the DEMOANYG program.
The following sections provide slightly more detailed discussions for using
forms.
Setting Up A Form
Before a form can be processed, there are some suggested as well as
required steps which must be taken. The optional steps involve such
details as clearing the screen before generating the form, printing explicit
instructions to the user, and setting the insert status or other features in
the Frm TYPE variable. It is beyond the scope of this user's guide to
cover all such optional aspects of programming. Instead, we'll provide
the basics below, and encourage you to experiment on your own, using
portions of the included demonstration programs as building blocks for
your own programs.
The BASIC statements for required include files are summarized below:
'$INCLUDE: 'FLDINFO.BI'
'$INCLUDE: 'EDITFORM.BI'
'$INCLUDE: 'SETUP.BAS'
'$INCLUDE: 'MYFORM.BI' 'this Includes the TYPE
' structure for your form
The required dimension statements are shown below, and they rely on the
Include files mentioned in the previous section:
DIM Frm AS ForminfoG
REDIM Fld(O) AS FieldlnfoG
REDIM Form$(0, 0)
REDIM Choice$(0, 0)
Once the form is loaded, its screen image is displayed using the Show Form
subroutine discussed earlier.
I measures which you must take for them to work properly. First, you must
include the module LISTBOX.BAS instead of NOMULTG.BAS. This way
the full ListBox subprogram will be available to your program.
For example, suppose a form has only 2 multiple-choice fields and that
the first, field number 2, is for soft drink selections while the second, field
number 6, is for T-Shirt sizes. Let's also suppose that there are 5 soft
drinks and 3 T-shirt sizes available.
One way to redimension and initialize the Choice$0 array for this example
would be:
REDIM Choice$(0 to 5, 0 to 1)
Choice$(0, 0) "2" 'Choices for field 2
Choice$(1, 0) "Pepsi"
Choice$(2, 0) "Coke"
Choice$(3, 0) "Dr. Pepper"
Choice$(4, 0) "7-Up"
Choice$(5, 0) "Canada Dry"
'Choices for fields 6, 15 and 16
' choice array
Choice$(0, l) "6, 15, 16"
Choice$(1, l) "Small"
Choice$(2, l) = "Medium"
Choice$(3, l) = "Large"
As you can see, Choice$0 element (0, N) shows which field uses the list
of choices in subscripts (I, N), (2, N), (3, N), and so forth. Further, this
element can specify that several fields will share the same series of items.
This keeps the Choice$0 array as small as possible.
SETUP.BAS include file to use black text on a gray background for list
boxes. SETUP.BAS include file.
If GPDat%(90) is set to -1, the list box will appear in the same colors as
its associated field. (These colors are inverted to create the highlight bar.)
The list box will display a scroll bar if the number of choices exceeds the
value of GPDat(99). The default value is set to seven, but you may specify
any number greater than six. You can change the colors used for the list
box scroll bars by changing the settings of the following GPDat% array
elements. The default color assignments in SETUP.BAS are for standard
gray.
For instance, suppose that field 1 holds the current date and field 4 holds
a tax rate. The calling program could initialize these fields like this:
I
Forrn$(1, 0) = DATE$
Forrn$(4, 0) = "7.5%"
One last comment regarding Form$() is that for notes (or multi-line text)
fields the entire field is returned as a single string. Blank lines embedded
in notes fields are returned as a CHR$(20).
If you modify the contents of a field in the Form$O array after editing has
begun, you must call either EditFormG with Action set to 1 or PrintArray
with the appropriate field number to display the new contents. EditFormG
redisplays the contents of the entire form while PrintArray can be used to
redisplay only a specified range of fields.
Using EditFormG
Once a form is properly initialized, you will call EditFormG to perform
data entry. EditFormG works much like BASIC's INKEY$, and, as such,
it is designed to be called repeatedly in a loop. When a routine is called
in this way it is said to be polled. Polling offers a tremendous level of
flexibility since the calling program becomes an extension of the process-
ing logic. For instance, polling lets you modify a form on-the-fly, that is,
while the form is being used.
Earlier we discussed the form variables: the Form$0 string array, the field
information Fld0 TYPE array, and the form information Frm TYPE
variable. Each variable contributes or provides information about a form,
and, together, these variables can be both accessed and changed while a
form is being used.
These important form variables are reviewed below, in the context of how
they can be used with EditFormG.
I
Form$()
In general, the Form$0 string array (see Form$() array) is used to pre-fill
a form or to examine data provided by the user. If needed, data in other
fields can be changed based on information already entered. For example,
if one field on your form is for Gender, and accepts "F" for Female and
"M" for Male, then a subsequent field for a Salutation could be automat-
ically pre-filled with "Mrs." or "Mr.", respectively. Doing this with
EditFormG is easy, as you 'II see later.
In this example, the program checks whether "F" or "M" has been entered
into the Gender field (field number 5). If the field is null, then no action
is taken. If it contains an "F", then the Salutation field (field number 8)
is set to "Mrs.". It is likewise set to "Mr." if the Gender field contains
an "M":
I Action%= 1
DO
CALL EditFormG(Form$(), Fld(), Frm, Action%)
IF Frm.PrevField Frm.FldNo THEN
SELECT CASE Frm.PrevField
CASE 5 'did we just leave field 5?
IF Frm.FldEdited
IF Form$(5, 0) = "F" THEN
Form$(8, 0) "Mrs."
ELSE
Form$(8, 0) "Mr."
END IF
END IF
Action% 1 'this forces the next call to
' EditFormG to refresh the form
CASE ELSE
'CASE ELSE is needed with QB 4.0 only
END SELECT
END IF
LOOP Until Frm.KeyCode = 27
There are many tricks you can perform by manipulating the Graphics
QuickScreen form variables which have been presented. One common
example is building shortcut keys into a form so that a user can skip large
portions over several fields at a time. For complex forms this is useful.
To illustrate, you could decide that field IO is to be associated with the F2
key, while field 20 is to be associated with the F3 key. This way, you
could examine Frm.KeyCode each time EditFormG is called. You could
then test for F2 or F3 and set Frm.FldNo so it points to a new field. This
would allow a user to move instantly between fields 10 and 20 with a single
keystroke.
SELECT CASE Frm.KeyCode
CASE -60 'They pressed F2
Frm.FldNo 10 'Go to field 10
CASE -61 'They pressed F3
Frm.FldNo 20 'Go to field 20
END SELECT
Navigating A Form
Fields are accessed in a form through a number of methods. Fields may
be selected by clicking on them with the mouse or by using the TAB,
Shift-TAB, or cursor direction keys. The effect of each key is summarized
below:
I
time.
Shift-TAB Moves backwards through a from one field at
a time
Right-Arrow Moves forward to the next field when the
cursor is at the end of the current field
Left-Arrow Moves backwards to the previous field when
the cursor is at the beginning of the current
field.
Up-arrow Moves to the field above the current cursor
position
Down-Arrow Moves to the field below the current cursor
position
For the Up and Down arrows keys to work correctly, no field may be
located higher than the first field on the form or lower than the last field
on the form. The Up and Down arrow keys can be disabled by setting
the UpDnArrows constant in the EditForm module to 0.
When you reach the end of a data entry field, the setting of the StayOnField
Constant in the EditForm module determines whether the cursor stays in
the current field or automatically jumps to the next field. When set to
True (-1), the cursor remains in the current field. The default value is
False (0).
Once the data files are open and the form arrays are initialized, you can
use the GetRecG and SaveRecG routines to load and save records,
I
respectively. Before retrieving records, you should know the upper
limit-that is, the total number of records currently stored. This value is
determined by dividing the current length of the data file by the record
length of the form being used:
LastRecord& = LOF(Fld(O).RelHandle) \ Fld(O).StorLen
Notice that the OpenFilesG routine assigns a BASIC file number for the
associated .DTA file to Fld(0).RelHandle. Although you probably won't
need to access it, OpenFilesG also assigns to Fld(0).Scratchl the handle
for the . NOT notes file.
Retrieving Records
To retrieve a record from the data file, simply call the GetRecG routine
giving a valid record number in RecNo:
CALL GetRecG(RecNo&, Form$(), Fld())
This loads only Form$(0, 0) with information. You will need to use the
U nPackBuffer routine to transfer form buffer contents to the individual
form data elements:
CALL UnPackBuffer(FirstFld%, LastFld%, Form$(),
Fld())
To fill the entire form with information from the form buffer, FirstFld
should be I, and LastFld should be assigned to the total the number of
fields in the form. The total number of fields is found in Fld(0).Fields.
If you wish only to fill a portion of the form with information from the
form buffer, you can specify other values for FirstFld and LastFld,
realizing also that several ranges of fields can be filled by calling
UnPackBuffer several times with different values.
The next step is to copy the information in the form data elements onto
the screen. The easiest way to do this is to call EditFormG with an Action
of I (see Action for details). This also ensures that all of the fields that
are displayed on the form are current. You can optionally call the
PrintArray routine, which provides more flexibility by allowing a specific
range of fields to be updated.
Saving Records
Record data is written to disk by calling the SaveRecG routine. All you
need to do is furnish the record number in RecNo:
CALL SaveRecG(RecNo&, Form$(), Fld())
I
SaveRec writes information to the .DAT and . NOT data files opened earlier
by the OpenFiles routine.
Clearing A Form
The best way to clear a form is to set each Form$(N, 0) element to a null
string. You may then want to pre-assign certain fields in the form before
allowing a new record to be entered. The code fragment below clears the
Form$() data elements, sets the date and time information, and sets Action
to I before EditFormG is called again.
Notes Fields
Notes fields (sometimes referred to as MEMO fields) have a variable
length and they are stored in a separate file. Although you could set aside
a certain number of bytes for a notes field in each record database, that
would be wasteful for records that have no notes or only a few characters.
Using Notes
If you plan to use the multi-line notes feature in your form, you will need
to replace the NONOTESG.BAS stub file module with the GQEDITS.BAS
module.
Data entered into notes fields is stored in a separate file with a .NOT
extension. For each note field in a form, the Form$(0, 0) array element
contains a long-integer pointer into the notes data file. This pointer
accesses a two-byte integer in the notes file which gives the length of the
string stored in the following bytes. The next note in the notes file
immediately follows, and also begins with a two-byte integer giving the
length of the note text, and so on. This arrangement keeps the notes file
as compact as possible.
I If you want to pre-fill a notes field with data, all you need to do is to fill
the Form$() array with text. Recall that text is stored as a single line of
information, using a CHR$(20) to indicate a blank line. Thus, to pre-fill
field 6 in your form, you would write to Form$(6,0):
Form$(6,0) = "This is line one of a note field
"+ CHR$(20) + "and this is line two."
Relational Fields
Graphics QuickScreen provides ways to store information which can be
used to create relational database fields. These are fields which are
common to two or more forms. For example, a customer number could
be the record key to a customer file, and the same customer number may
also appear as a field in an invoice file. Related fields make it easy to
access information stored in different data files which is linked together
by a common field.
Relational fields eliminate duplication (and thus wasted disk space) in your
data files. As long as the customer number is stored in the Invoice file,
there's no need to also store the customer's name and address there too.
That information can be read from the Customer field when needed, using
the Customer number field in the Invoice file to find the corresponding
record in the Customer file.
While Graphics QuickScreen does not directly support related data files,
it does offer a means by which your own programs can store and access
information for related fields.
If you want to create a related field for field N in the current form, you
would need to store information in the Fld(N).RelFile and Fld(N).RelFld
field array elements. These two type elements describe the related file
and field names, respectively.
If you want to access the related file by its file number rather than by its
name, you can open the file and store its BASIC file number in the
Fld(N).Re!Handle TYPE array element. Using file numbers provides
fast access, but this technique requires the file to be already open.
Indexed Fields
I
As with related fields, Graphics QuickScreen does not provide support for
field indexing. However, it does provide a way to indicate that certain
fields are indexed. You can use this to know if a given field is indexed
when looking up records in the file. For instance, if field N of the current
form is indexed, you would set Fld(N).Indexed to show that. Indexes are
used to accelerate record searches and sorts, and most books on database
design explain them in detail.
Note that if your form uses scroll bars, the scroll bar's small change value
is stored in Fld(N).lndexed. You should therefore exclude scroll bars
when searching the FldO array for indexed fields:
Multi-Page Forms
One important feature of Graphics QuickScreen is its ability to manage
multi-page forms. This feature exploits the ability of the Frm0 and
Form$() arrays to hold several forms at once. Each "page" of a multi-page
form is a standalone screen that is created separately in the Screen
Designer.
Screens are designed so that they appear to visually follow one another-
either from top to bottom (for tall forms) or from left to right (for wide
forms). Using various wipe effects, you can achieve the illusion of moving
up and down through a long form. Thus, pressing PgUp could scroll a
new page down from the top of the screen using the "SlideD" wipe, while
PgDn could make use of the "SlideU" wipe. Even though each screen is
entirely separate, each accesses a unique range in the form arrays, making
multi-page forms possible.
To illustrate the need for multi-page forms, suppose you want to allow 60
lines for item-entry on an invoice form. In 25-line mode, you would need
I three different "pages" to contain all of the data. The first page would
contain header information, such as customer information, and would also
begin the columnar section which forms the line-item section of the invoice
(this is where part numbers, descriptions, and price information is
entered). The second page would probably consist entirely of the line-item
section of the invoice. The last page would complete the line-item section,
and also have "footer" information, such as price totals and special
shipping instructions.
Implementation
From a programming perspective, the concept behind multi-page forms
is simple: place the names of your forms in a string array. This lets you
refer to each screen by number and your program can increment and
decrement a screen counter to access the next or previous screen image,
respectively. When a user presses PgDn, or moves beyond the last field
on the current "page", you will increment the screen counter and display
the next "page" of the form. Likewise, pressing PgUp, or moving beyond
the first prompt, will access the previous "page".
The next step is to fill the Fld0 TYPE array and the Form$() string array
with the field data stored in the .FRM or MYFORM.BAS file.
Now that the form arrays are loaded and properly initialized, you can call
the EditFormG routine. While using EditFormG, if PgUp is pressed then
Frm.StartEl is assigned to one less than the starting field number for the
current form. If PgDn is pressed then Frm.StartEl is assigned to one
greater than the highest field number on the current form. Thus, a calling
program can check Frm.StartEl to determine whether either PgUp or
PgDn has been struck.
Because a multi-page form creates an extra element in the form arrays for
each form "page", we suggest using the Form$(0, 0) form buffer (rather
than the Form$(N, 0) data elements) when writing or reading from the
data file.
I
(such as PgUp, PgDn, or function keys you wish to use) to determine
whether the user is trying to access a prior or next "page" in the form.
Action%= 1
DO 'Poll the editing procedure
CALL EditFormG(Form$(), Fld(), Frm, Action%)
'If the user pressed PgUp or PgDn or moved off
' the top or bottom of the form, "StartEl" will be
updated by "EditFormG" so we need to check it.
The last value is saved in "LastStartEl for 11
use as a comparison.
If you are using the optional BASIC field definition modules to assign field
definitions, you will have to make minor source code modifications to
them to create a multi-page form. The FldO and Form$O arrays are
dimensioned at the beginning of each field definition subroutine. (These
arrays are named Fd() and F$() in the source file.) The module containing
the field definitions for the first page of your form should be modified to
dimension the Fld() and Form$() arrays to the total number of fields in
your multi-page form. You then need to remove the REDIM statements
from the remaining field definition modules. When calling these field
I
definition modules, you must set the Start% parameter to the appropriate
element within the entire Fld() array so that the field definitions are loaded
- into the correct elements.
Programming Tips
The following sections provide additional programming tips which you
may find both interesting and useful.
DO
CALL EditFormG(Form$(), Fld(), Frm, Action)
IF CLNG(TIMER) T& THEN 'Display the time
each second to
T& = TIMER show how things
LOCATE 1, 70, 0 can be done while
PRINT TIME$; a form is being
END IF' edited.
LOOP UNTIL Frm.KeyCode 27 'Keep editing until
user presses Esc.
When this routine executes, the time is updated while the form is accepting
user input. This example demonstrates how two activities (processing a
form and updating the time) can appear to occur simultaneously.
Form$(DateFld%, 0) = DATE$
I
This example shows how the variable DateFld is assigned to the field
number corresponding to the field called "JNVDATE". If the form
changes and the field position ofJNVDATE is altered, this method ensures
that the correct field receives the DATE$ information.
I After you have made the desired changes to the form data, you can
redisplay information in the form by calling the PrintArray routine.
PrintArray is described in the Routines section of this manual.
If you are using the mouse field as a toggle check box, the corresponding
Form$(N, 0) array element will hold an X when it is checked or a space
when it is not. To activate a mouse field from code, assign an X to the
corresponding Form$() array element to select (highlight) the field or
assign a space to deselect (un-highlight) it. You must then call EditFormG
with Action set to I or call PrintArray with the appropriate field number
to display the new status.
If all of the fields on the form are buttons, it will probably be unnecessary
for you to test for the field number.
I
Handling Scroll Bars
Scroll bar values are returned in the Fld(N). Value variable. Simply assign
this value to the appropriate variable in your program. The following
examples assume that a scroll bar has been assigned to field number 25:
Tempo= Fld(25).Value 'Assign the "Tempo" value
In most cases you will only want to respond to the value if it has changed.
In that case, assign a variable to remember the previous value, and compare
it with the current value:
Normally, a scroll bar returns its maximum value when the pointer is at
the bottom of a vertical scroll bar or at the right side of a horizontal scroll
bar. To make the value of a scroll bar read in the opposite direction,
subtract Fld(Frm.FldNo).Value from Fld(Frm.FldNo).HiRange before
assigning your variables:
IF Fld(Frm.FldNo).Value <> LastValue THEN
LastValue = Fld(Frm.FldNo).Value
Tempo= Fld(Frm.FldNo).HiRange -Fld
(Frm.FldNo).Value
END IF
You may also re-assign any or all of the scroll bar's settings at runtime.
You can set new high and low limits, small and large change values or
reposition the scroll pointer. After changing any of these variables you
must either call PrintArray with the appropriate field number or reset
Action to 1 before the next call to EditFormG. Either of these methods
will reset the scroll bar to its new settings.
IF ChangeValues then 'Set new Scroll values
Fld(25).HiRange = 1000 'Set new upper limit
Fld(25).LoRange = -200 'Set new lower limit
Fld(25).Value = 150 'New pointer position
Fld(25).Re1Fld = 50 'New large change value
END IF
' scroll bar
Note that calling PrintArray redisplays only the fields specified. Setting
Action to 1 will accomplish the same thing but redisplays all fields on the
form and is therefore somewhat slower.
You may also reset a scroll bar's value by assigning the desired value to
the Form$(N, 0) array, where N = the scroll bar's field number. In this
case, you must call EditFormG with Action = 1.
The color used when clicking on the scrolling portion of a scroll is assigned
according to the setting of GPDat%(100). The default is to use whatever
color was used for the shaded portion of the scroll bar's push buttons. You
can also disable a highlight color or specify any other color. See appendix
A, The GPD01%() Array for more information on setting GPDat%(100).
I
I
Graphics QuickScreen Creating Standalone Programs
MAKE Files
Make files with a .MAK extension are created by the BASIC environment
whenever a program requiring more than one module has been saved.
They are ASCII files with a . MAK file extension, and they simply list the
names of other modules which must be present in order for the main
module to run. All these modules must be compiled to object files and
then linked together with the GFORMS.LIB library or GFORMS7.LIB
when using BASIC 7 PDS.
Compiling Modules
BASIC source files are compiled using the BC.EXE command line
compiler like this:
BC MYPROG.BAS /0/S;
Linking
Once you have compiled all of your programs, you need to create a final
standalone .EXE program. This is done by linking object files with the
provided GFORMS.LIB library or GFORMS7.LIB when using BASIC 7
PDS.
I
If you are compiling and linking manually from DOS, then you will specify
all your BASIC-compiled object modules, along with GFORMS.LIB (or
GFORMS7.LIB), like this:
LINK PROG1.0BJ+PROG2.0BJ,,NUL,GFORMS[7].LIB
If you prefer you can start LINK without any options, and wait for it to
prompt you for the information it needs.
You may also specify more than one library when linking. For example,
if you need assembler routines from both GFORMS.LIB and our QuickPak
Professional, you would tell LINK to use both of them:
You may also add single object modules when linking, even if they are not
present in a Iibrary at all:
LINK PROG1.OBJ+PROG2.OBJ+MYOBJECT.OBJ,,NUL,
GFORMS[7] MYSTUFF
If you prefer to combine several libraries into a single .LIB file, that is
quite easy too. Although the LIB library manager is usually employed to
add or remove object modules, you may also add one or more complete
Iibraries Iike this:
LIB LIBRARY1.LIB+LIBRARY2.LIB+LIBRARY3.LIB
One useful link opt'on you should be aware of is the /E command line
switch. When LINK is invoked with IE, it creates an .EXE file in a special
packed format. Not unlike the various archive programs, the code and
data are compressed to take up less disk space. When the program is run,
the first code that actually executes is an unpacking routine that puts
everything back together again. The /E switch is specified like this:
LINK /E PROG1.OBJ+PROG2.OBJ,,NUL,GFORMS[7]
■
I
Graphics QuickScreen Utilities
In order for PCXCAP to run properly, you must start it from DOS before
running the program whose screens you wish to capture. Before running
PCXCAP, you should consider the following points which apply to all TSR
programs:
2. When using more than one TSR program, the last TSR installed
must be uninstalled first
I
in a Graphics QuickScreen compatible screen mode, i.e. 640x350 or
640x480 16 color.)
One note of warning: PCXCAP uses the screen name you specify and does
not caution you if you will overwrite an existing screen with the same
name. For this reason, be extremely careful when naming PCXCAP
screens to be saved.
When you run QS2GQS.EXE, it displays a dialog box that prompts you
for the following information:
Enter the name of the screen (.SCR) file or the screen library
(.QSL) file name. Be sure to include a complete path name if the
file is not in the current directory.
Enter the drive, directory, and file name for the converted screen.
Since a modified . FRM file is created, make sure you save the file
I
to a different name or directory to prevent overwriting the original.
Once you have entered the required information click the OK command
button. The utility will read the screen and its form definition files into
memory. A second dialog box will appear allowing you to select the
desired graphics mode. The dialog box's option buttons will default to
the closest matching screen mode based on the number of screen rows
required. You can of course select any screen mode you prefer.
If the your screen has more rows than the selected screen mode allows,
the screen will be clipped as necessary at the bottom. Field definitions
that would be located beyond the last row are placed on top of each other
and will have to be relocated manually in the Graphics QuickScreen editor.
If the screen has fewer rows than the new selected screen mode, the
converted screen is positioned at the top of the screen leaving the bottom
portion blank.
Click the OK button and your screen will be quickly converted and
displayed in the graphics mode you selected. Once the conversion is
complete, you may continue with additional conversions or press Esc to
exit the utility.
Note that this utility cannot read QuickScreen . QFL files. You must supply
individual .FRM files for each form that you convert.
I
declared but are not being used. Of course, those routines will not be
added to the resultant Quick Library. It will also report all subprograms
and functions that are present but never called. As an option, you may
specify a file that contains a list of all the routines that are to be included
in the library, rather than having MAKEQLB examine your source files.
MAKEQLB uses an interface similar to the LINK and LIB programs, and
you may either enter the parameters on a single line, or wait for
MAKEQLB to prompt you for them. The command line syntax is as
follows:
You may also specify more than one file name to be examined, by
separating each with a blank space:
MAKEQLB rnainprogl rnainprog2, qlbnarne, listfile,
libl lib2, bqlbnarne
The qlbname parameter is the name of the resultant Quick Library. If the
name is omitted, the library will have the same name as the main program,
but with a .QLB extension. If indeed you omit qlbname, be certain to
retain the delimiting comma. If you specify NUL for the qlbname,
MAKEQLB searches for unnecessary DECLARE statements and dead
code, but will not create a Quick Library.
The list file that is created contains a list of all the routines that are being
added to the Quick Library. This file defaults to a .LST extension, and
is in the correct fornat that MAKEQLB requires to create a library from
a list of procedure names. This way, if you need to add a routine or two
to the Quick Library later on, you can simply edit the generated .LST file.
Creating a Quick Library from a list file is of course much faster than
examining an entire BASIC program. If the listfile parameter is omitted,
the same name as the main program will be used, but with an .LST
extension. To tell MAKEQLB not to create a list file, use the reserved
name NUL for that parameter.
The lib! and lib2 parameters are .LIB library files that contain the
procedures being added to the Quick Library. One or more library names
may be specified, with a blank space used to delimit each name. If no
library name is given, the name PRO.LIB is assumed.
LINK. The dirty work of extracting each routine from the various .LIB
files is thus handled entirely by LINK.
4.0 BQLB40.LIB
4.0b BQLB41.LIB
4.5 BQLB45.LIB
6.0 depends on QB version number
7.x QBXQLB.LIB
I
CRESCENT SOFTWARE. INC. ■ 11-5
I
12
I
.
I
-
Graphics QuickScrecn Product Compatibility
Graphics Workshop
Use the same standard code as found in the Graphics Workshop manual
(pg 1-12). GETVIDEO.BAS is used in place of the SETUP.BAS include
file. You will need to increase the size of the GPDat% Oarray from 86 to
100 elements. The GPDat%() array is dimensioned in GETVIDEO.BAS
and should be modified as follows:
REDIM SHARED Tile$(0), AltTile$(0), GPDat%(100)
The SETUP.BAS include file also sets default colors for the help messages,
list boxes, and list box scroll bar colors as follows:
GPDat(88) = 15 Highlight
GPDat(97)
GPDat(98)
=8
=7
Message box shade color
Replace the COMMON.BI include file in all modules with the COM-
MON.GW file from the Graphics Workshop. This can be accomplished
by loading all of the required modules into the QB editor and using its
global search and replace capability. You will also need to modify
COMMON .GW by adding the Choice$() array to the list of COMMON
SHARED variables:
COMMON SHARED GPDat%(), Font$(), FontWidth%(),
FontHeight%(), Choice$()
GraphPak Professional
Replace the SETUP.BAS include file with SIMPLE.BAS. You will need
to increase the size of the GPDat%() array from 63 to 100 elements. The
GPDat%() array is dimensioned in GETVIDEO.BAS and should be
modified as follows:
REDIM SHARED Tile$(0), AltTile$(0), GPDat%(100)
The SETUP.BAS include file also sets default colors for the help messages,
List boxes and List box scroll bar colors as follows:
I
- GPDat(88)
GPDat(89)
= 15
=8
Highlight
Shaded portion
Replace the COMMON.BI include file in all modules with the COM-
MON.BAS file from Graphpak Professional. This can be accomplished
by loading all of the required modules into the QB editor and using its
global search and replace capability. You will also need to modify
COMMON.BAS by adding the Choice$() array to the list of COMMON
SHARED variables:
Calling Show Form performs the same function as calling Set Video, though
you can still call SetVideo first.
db/LIB
Graphics QuickScreen provides four BASIC subroutines for interfacing
Graphics QuickScreen with AJS Publishing's db/LIB. These routines are:
db2FormG
dbDefineRecG
Transfers and converts data from a db/Lib
record to the Form$() array for editing
If you develop your program in the BASIC environment, you will need to
make a combined Quick Library that contains the required library routines
from both the GForms[7) library and the appropriate library from AJS.
This can be accomplished by using the MAKEQLB utility supplied with
this package. See the QUICK LIBRARY MAKE UTILITY form more
details.
I
.
■
II
Graphics QuickScreen Trouble Shooting
TROUBLE SHOOTING
Occasionally, the mouse cursor may disappear after the selection of a new
screen mode or after loading a new screen. If this should occur, the cursor
can be brought back by pressing Ctrl-Fl.
This will happen if all of the fields in a form are protected. You must have
at least one non-protected field on your form.
This too will happen if all of the fields in a form are protected. You must
have at least one non-protected field on your form.
You receive an "Out of string space" error when you run your pro-
gram from the BAS! C environment.
If you still receive the error, you can uses the various "No" stub files as
you develop your program. Then when you compile and link your
program, make sure to use the full-featured versions of the subroutines.
This indicates that the routine being called has not been loaded. If the
message refers to a BASIC routine, you must add the module that contains
it to your program by using the (File) Load command. If the message
refers to an assembler routine, then either the routine is not in the loaded
quick library, or you failed to start BASIC with the required quick library.
You can easily determine whether a routine is BASIC or assembler by
looking up the routine in the Routines section of this manual. The heading
at the top of the routine description indicates that the routine is either a
"BASIC subroutine contained in BASF/LE.BAS" or an "assembler sub-
II
routine contained in GFORMS.LIB"
This indicates that the various support files required by Graphics Quick-
Screen cannot be found. These files are installed initially in your Graphics
QuickScreen directory. If you work from any other directory, change the
path settings in the Set Paths dialog box found under the Settings menu
to point to your Graphics QuickScreen directory (or the directory where
they currently reside). These files are listed below:
APPENDIX A
Note that GPDat%(90) must be set to -1 for these colors to take effect.
Note that GPDat% (90) must be set to -1 for these colors to take effect.
GLOSSARY
calculated field
cursor keys
Keys which control the movement of the cursor. These keys typically
include the Up, Down, Left, and Right keys, and sometimes include PgUp
and PgDn.
dialog box
dithered colors
form
.FRM files
hotkeys
Keys which directly access an item on a menu bar or pulldown menu. The
characters corresponding to hotkeys are usually underlined or highlighted.
insert mode
The edit mode in which each character to the right of the cursor is moved
to the right as new characters are entered.
menu bar
One of the menu names on the menu bar. A menu bar option usually
presents a pulldown menu.
paste buffer
pollable routine
pulldown menu
ROM font
TUTORIAL
In the following tutorial, clicking on refers to pointing to an item with the
mouse cursor and then clicking and releasing the left mouse button.
When you first start Graphics QuickScreen you are presented with a blank
screen and a standard white arrow cursor. To design a screen with
Graphics QuickScreen you will need to access the various paint and
drawing tools available on the Drawing Palette. Try clicking the right
mouse button several times to toggle the Drawing Palette on and off. The
Esc key will also toggle the Drawing Palette.
Selections are made from the Drawing Palette by clicking on the desired
color or tool icon. The selected color will appear in the lower right comer
of the Drawing Palette. Selecting a tool clears the Drawing Palette and
displays a drawing/editing cursor. Objects (lines, circles, boxes and so
forth) are created by clicking on the desired starting position and then
moving the drawing cursor to size the object. If you make a mistake, click
the right mouse button once to cancel and begin again, or click twice to
return to the Drawing Palette. Finish the object by clicking on the desired
end point.
You may continue drawing with the same tool or you can click the right
mouse button to return to the Drawing Palette. If you make a mistake,
pressing FIO will undo any drawing or editing done since the selection of
the current tool.
When you select a drawing or editing tool, a drawing cursor will appear.
As you move the cursor around the screen, you will notice that the drawing
cursor does not move smoothly but rather skips from point to point on an
invisible grid. This is called grid snap. On start up, grid snap is ON and
is set to spacings that correspond to the height and width of the text font
for the current screen mode. Grid snap spacings can be set to almost any
value but are particularly useful when used with the default settings. The
reason for this requires some explanation.
When you design screens with data entry fields, a field's text is displayed
using the computer's internal ROM font. Text is printed at standard text
row and column coordinates using a solid background color. These fonts
are always 8 pixels wide and are either 8, 14, or 16 pixels high depending
on the screen mode. The text foreground color is defined when you assign
field definitions, but the background color is read from the screen at run
time. (In truth, the background color is set according to the color of the
pixel located at the lower right corner of the first character position in the
field.)
You will often want to paint a field's background using a color that contrasts
with the surrounding screen to identify the field's boundaries. When you
select the Filled Box icon with the default grid snap settings, any box you
draw will be the exact size required to contain standard text.
Select a color and then click on the Filled Box icon (black rectangle) to
select the Filled Box procedure. Try drawing several filled rectangles.
When you are finishc,d you can click the right mouse button to return to
the Drawing Palette. Now select a new color and click on the "T" icon.
A blinking text cursor will appear at its last used location. You can position
the cursor with either the direction keys or the mouse and then begin
typing. Notice that any text you type will line up with the blocks you just
painted.
Grid Snap can be toggled on and off during any drawing or editing
procedure by pressing the S key (grid Snap). Notice that the Up, Down,
Left and Right cursor arrow keys always move the cursor in increments
that correspond to the current grid snap settings. Cursor movement is
therefore much faster from the keyboard when grid snap is turned on.
When the Drawing Palette is off you can click the left mouse button or
press Alt to activate the menu system. When selected with the mouse,
the last menu used will be displayed. Selections are made by clicking on
them with the mouse, pressing the underlined or highlighted hotkey, or
using the Up and Down arrow keys to highlight the desired choice and
then pressing Enter. When activated by the Alt key, only the menu bar
is activated. Menus can be accessed by pressing their underlined hotkey,
pointing and clicking with the mouse, or by using the cursor keys and
pressing Enter.
Try experimenting with the various drawing and editing tools to get a feel
for how Graphics QuickScreen works before moving to the next section.
If grid snap settings correspond to the current ROM font size (referred to
as text snap), a black rectangle (II) will appear in the Status box next to
the Y or C label. If text snap is off, press the F key to turn it on. This
key toggles between the current grid snap settings and appropriate text
snap settings. You will hear two different beep tones as you toggle the F
key. The higher pitch indicates that text snap is in effect.
If you want to clear the screen before starting this exercise, select (File)
New Screen... . A dialog box will appear allowing you to select a new
screen mode. Click OK after making your selection. The screen will be
cleared to the current background color as assigned in the System dialog
box under the Settings menu.
Activate the Drawing Palette and select the push button icon. Draw a
single push button anywhere you like. If you wish to change colors or
draw a larger push button, select a new color and draw another push button
over the old one. You can also press FlO to clear the image or use the
Recolor option to change the push button's colors.
At this point, the push button is just a graphic image and will not function
as a button until it is defined as a field. This will be discussed shortly.
Now select Scroll Bar from the Draw menu. Draw a scroll bar just as
you drew the push button. If the defining rectangle is wider than it is high,
a horizontal scroll bar is drawn. Otherwise, a vertical scroll bar is drawn.
As with the push button, the scroll bar is just a graphic image until it is
defined as a field.
1+11 l+I
The next step is to define these images as fields. Select (Compose Fields)
Enter Field Definitions... . A message box will appear asking you to
place the cursor at the beginning of the first field. Move the cursor to the
beginning of the text field and double-click the left mouse button or press
Enter. Another dialog box will appear allowing you to select the field
type.
For now, select the default String type field by clicking on the OK button
or by pressing Enter. A third dialog box appears asking you to locate the
end of the field. Use the cursor keys or the mouse to adjust the size of
the field. When you are satisfied with the size, double-click the left mouse
button on the last character in the field or press Enter. A final dialog box
lets you enter specific field settings. Accept the default settings by clicking
the OK button or by pressing Enter.
When defining mouse fields, push buttons or scroll bars, the initial starting
position of the field is irrelevant since it is redefined after the next step.
Simply press Enter or double-click the left mouse button when prompted
"Place the cursor at the beginning of the field". Select "Push Button"
and click the OK button or press Enter. A message box then asks you to
"Draw a box around the Push Button". As soon as you press a cursor key
or move the mouse, the message will disappear.
Draw a box that exactly matches the black outline of the push button. With
grid snap on this should be very simple. When the box is completed, the
field settings dialog appears. For now, accept the defaults by clicking the
OK button or by pressing Enter. Define the scroll bar using the same
process but this time select "Scroll Bar" from the Field Type dialog box.
Once fields have been defined the form can be tested by selecting
(Compose Fields) Try Data Entry in Form. Now the push button will
depress when clicked on, the scroll bar will scroll, and you will be able
to enter text in the text entry field. You can move from field to field by
pressing Tub to move forward or Shift-Tub to move backwards through
the form. You can also select any field with the mouse by clicking on it.
When you are finished testing, press Esc to restore the screen and return
control to the screen designer.
For this exercise, copy the push button. Once you identify and capture
the image, you can make as many copies as you wish. This procedure
copies not only the graphic image of the button but also its field settings.
Unique field names are generated automatically for each new field. Once
you have completed making your copies, you can test the new push buttons
by selecting (Compose Fields) Try Data Entry in Form. As you can
see, this is an extremely fast way to generate duplicated field types.
Once you are satisfied with your form, Graphics QuickScreen can option-
ally generate a BASIC source file that you can run from the BASIC editor.
This file will behave as if Try Data Entry in Form had been selected.
Having Graphics QuickScreen create this portion of a program is a
tremendous time saver because it automatically sets up the correct declare
statements and include files for you. A .MAK file is also created that
specifies all of the modules required to display and edit your form.
To run the demo, exit Graphics QuickScreen and start your version of
BASIC with the appropriate library-GFORMS. QLB or
GFORMS7.QLB. Use the (File) Open ... command from the BASIC
editor to load the demo. Once loaded, press Shift-FS to run it. Pressing
the Esc key will end the program and return you to BASIC.
At this point, all of the form editing code has been written. You will still
need to add code to handle values returned by mouse fields, push buttons,
and scroll bars and to save or load the form contents.