home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
w3_apps
/
formcode.arj
/
DOC.TXT
< prev
next >
Wrap
Text File
|
1991-11-03
|
72KB
|
1,772 lines
WHAT IS FormCode/Gen? . . . . . . . . . 1
COMPATIBILITY:. . . . . . . . . . . . . 1
INSTALLATION & SETUP: . . . . . . . . . 2
HOW TO USE THIS MANUAL: . . . . . . . . 3
WYSIWYG APPLICATIONS: . . . . . . . . . 3
DIFFERENCES FROM TYPICAL
WINDOWS APPLICATIONS: . . . . . . . . . 4
PRINTING FROM WITHIN WINDOWS: . . . . . 5
CODE GENERATION STRATEGY: . . . . . . . 5
Program Files: . . . . . . . . . . 5
Understanding the Generated Code:. 6
SCREEN LAYOUT:. . . . . . . . . . . . . 11
DESIGN UNITS: . . . . . . . . . . . . . 11
FORM DESIGN OBJECTS:. . . . . . . . . . 11
BASIC DESIGN PROCEDURES:. . . . . . . . 12
Drawing Objects: . . . . . . . . . 12
Zooming and Panning: . . . . . . . 13
Selecting Objects: . . . . . . . . 13
De-Selecting Objects:. . . . . . . 14
Moving Objects:. . . . . . . . . . 14
Stretching Objects:. . . . . . . . 14
Editing Object Definitions:. . . . 14
MENU DESCRIPTIONS:. . . . . . . . . . . 14
The File Menu: . . . . . . . . . . 15
New: 15
Open: 15
Save: 15
Save As: 15
Gen Code: 15
Check Sheet: 15
Print: 15
Page Setup: 15
Label Setup: 16
Open DBF: 16
Memory Left: 16
Exit: 16
About: 16
The Edit Menu: . . . . . . . . . . 16
Delete: 16
Cut: 17
Copy: 17
Paste: 17
Move To Back: 17
Move To Front: 17
Group: 17
Un Group: 17
Toggle Select: 17
The Alignment Menu:. . . . . . . . 18
Center on Horz: 18
Center on Vert: 18
Snap X to Grid: 18
Snap Y to Grid: 18
Mark Align Ref: 18
Align Left: 18
Align Top: 18
Align Right: 18
Align Bottom: 18
The Settings Menu: . . . . . . . . 18
Grid: 19
Disp Grid: 19
Disp Crosshair: 19
Rulers On: 19
Gravity On: 19
Show Text Ext: 19
Hide Images: 19
Box Defaults: 19
Line Defaults: 19
Text Defaults: 19
Table Defaults: 19
DESIGN OBJECT DESCRIPTIONS: . . . . . . 20
Box Objects: . . . . . . . . . . . 20
Line Width 20
Fill Pattern/Shade 20
Border Type and shadow 20
Line Objects:. . . . . . . . . . . 20
Text Objects:. . . . . . . . . . . 20
Field 21
Expr 21
Build... 21
Font.. 21
Box... 22
Pattern.. 22
Justification 22
Margins 22
Table Objects: . . . . . . . . . . 22
Table Title 22
Column Title and Total Rows 22
Border Type 22
Define Columns 22
Column Width (23); Column
Body Background (23); Edit
Title, Body, Total (23)
Check-box Objects: . . . . . . . . 24
Bitmap Image Objects:. . . . . . . 24
WHAT IS FormCode/Gen?
FormCode/Gen is a unique piece of software that allows
you to design printed forms and mailing labels in the
powerful graphical environment of Microsoft Windows
and then generates native dBASE code to print these
forms from your favorite database management system
using your data. Windows is not required for printing the
forms, only for designing them. Your forms can contain
text with a variety of fonts, fill shades and patterns,
lines, boxes, background gray-shading and fill patterns,
tables, check-boxes, and bitmap images.
FormCode/Gen combines the power of Windows'
graphical, WYSIWYG, environment for interactively
designing the forms with the powerful data management
capabilities of the dBASE systems for actually printing
them with data. FormCode/Gen has been highly
optimized for printing at high speeds - which is untypical
of most windows applications. Code generated by
FormCode/Gen can print forms with speeds close to the
theoretical printing speed of the printer!
The code generated by FormCode/Gen is native dBASE
code so there is no need for any external libraries, etc.
This also allows free distribution of the generated code.
The generated code is highly structured and is divided
into a user and a system section. The system section
contains the actual coordinates of fields, font
information, etc, and can change when modifications to
the forms are made. The user should never modify this
section of the code since the changes will be lost when
the form is modified and code is re-generated. The user
section contains the query commands such as opening
databases, setting relations and filters, initializing and
incrementing variables and record pointers, etc.
FormCode/Gen generates a template for this section of
the program. The user can modify it according to his/her
needs.
Designing forms in FormCode/Gen involves the following
steps: Start up the program from Microsoft Windows;
design your form/label using the editing commands;
open any database files that you need and place the
dBASE fields on the form/label; save your file and
generate code; add the necessary commands for setting
up your query to the generated code; run your program
to print the forms you just designed. Note that you can
also print your forms from within Windows while you
are designing them, but these forms will not have actual
data in them.
COMPATIBILITY:
The code generated by FormCode/Gen is compatible
with the following systems: dBASE III Plus, dBASE IV,
FoxBASE Plus, FoxPro (both 1.0 & 2.0), Clipper
Summer 87, and Clipper 5.0. Run time justification of
memo fields, however, only works with FoxPro (both
1.0 & 2.0) and Clipper 5.0.
The output is compatible with all HP LaserJet and
compatible printers starting with the LaserJet Series II
and up. For the most part, the output is also compatible
with the older LaserJet model with the exception of
dealing with paper sizes other than the default.
The program requires HP LaserJet printer driver version
3.61 or later for Microsoft Windows for the LaserJet
Series III printers and version 3.3 or later for the
LaserJet Series II and older printers. Though older driver
versions may work they have not been tested. To find
out which version your printer driver is go to the printer-
setup dialog from the Windows Control Panel and then
click on the About button.
It is also recommended that you use printer driver for
the same type of printer on your development system as
your destination printer. For example code generated by
using a printer driver for HP LaserJet III should be run
only on Series III printers and not on Series II, etc. Using
a different driver may not always cause problems, but
some font selection codes do get interpreted differently
by the different printer models.
FormCode/Gen allows you to use all internal and
cartridge fonts for the LaserJet and compatible printers.
Soft-fonts can also be used. However, soft-fonts, if
used, must be permanent soft-fonts. That is they must
be loaded in the printer before code generated by
FormCode/Gen is run. Usually soft-font software will
modify your AUTOEXEC.BAT file to automatically
download all soft-fonts. FormCode/Gen itself will not
download any soft-fonts.
INSTALLATION & SETUP:
To install FormCode/Gen on hard disk C:, create a
subdirectory \FCG on the C: drive and then set this
directory as your current working directory by typing CD
\FCG. Next type:
A:UNPK_FCG
This will place all FormCode/Gen files in the directory
\FCG.
FormCode/Gen needs an extra printer installed from
Windows. This printer must be identical in type to your
default printer and should also have the same cartridges
installed for it as your default printer. Of course, both of
these printers must be HP LaserJet compatible. Also,
the font cartridges installed for these printers must exist
on the final destination printer where the dBASE code
will run to print the forms/labels that you design.
To install this extra printer follow these steps: Edit the
WIN.INI file in your Windows directory using a text
editor. Using your favorite text editor or Windows
Notepad, add a line to the [ports] section of this file.
This line should be:
FCG.TMP=
After you have added this line, save the WIN.INI file and
start up Windows. From the Windows Control Panel
double click on the Printer icon. This will bring up the
Printers dialog box. Click on the Add Printer button and
from the list of printers select the printer that you will
be printing to. Windows will tell you that a driver
already exists for the selected printer. Select the Current
option to tell Windows to use the existing driver. After
installing this new printer, click on the Configure button.
This will bring up the Printers-Configure dialog box.
From the list of ports presented, select FCG.TMP. This
option will only appear in the ports list box if you
modified the WIN.INI file properly as described earlier.
Next click on the Setup button to add any font
cartridges that you will be using.
Make the newly installed printer active from the Printers
dialog box. However, do not select this printer as your
default printer! This completes the installation process.
You should now have two printers installed from
Windows. The first one is your default printer that you
previously had installed in Windows. This printer is
connected to the actual physical port that you will be
printing to (e.g LPT1:, COM1:, etc). The second printer
is identical to the default printer in type and font
cartridges and is an active printer, but it is connected to
the pseudo port called FCG.TMP.
HOW TO USE THIS MANUAL:
Like most people, we are sure our users hate reading
program documentation and they are justified in doing
so. However, we encourage you to read the following
sections before you use FormCode/Gen. Believe us, this
will save you some grief later on. Important sections to
read: What Is FormCode/Gen, Installation and Setup,
Differences from Typical Windows Applications, Printing
from Within Windows, Code Generation Strategy, and
Bitmap Images (if you will be using bitmaps). The rest
of the manual can be used as a reference. Use it only
when you can't figure something out.
WYSIWYG APPLICATIONS:
As you perhaps already know, WYSIWYG is an acronym
for 'What You See Is What You Get'. In WYSIWYG
applications, the results of your efforts displayed on the
CRT screen closely match the final printed results.
Typically this means that fonts, and graphics are
displayed on the CRT screen as they would print on the
printer. Almost all Windows applications including
FormCode/Gen are WYSIWYG applications.
Even thought these applications display results that
match the printed output much better than non-
Windows applications, they have their limitations.
Following is a brief discussion of some of these
limitations:
The number one source of inaccuracy is fonts. There are
several reasons for this. First of all is the difference in
resolution between your printer (300 dots/inch) and the
display screen (usually under 100 dots/inch). It is simply
impossible to create fonts that are identical. The second
big difference is the source of the font. The font that is
used in Windows to display your text is more than likely
from a different vendor than the font that you will print
with. Windows tries to find the closest display font that
matches the printer font that you select, but in a lot of
cases the font is only remotely similar.
Another source of difference in FormCode/Gen arises
from the fact that FormCode/Gen allows you to select
a pattern for the text foreground also. This capability is
built into the Laser Jet and compatible printers.
However, trying to display the exact foreground
patterns in Windows is not possible without sacrificing
a great deal of speed. For this reason, FormCode/Gen
displays the different text foreground patterns by using
a different color for the text foreground.
One more source of inaccuracy appears in bitmaps.
Since bitmaps are also designed for the printers'
resolution, displaying them in Windows usually means
shrinking them. This shrinking can often result in images
that look fairly distorted. However, these images will
print OK.
DIFFERENCES FROM TYPICAL
WINDOWS APPLICATIONS:
FormCode/Gen works like most Windows applications in
most aspects and also complies to the IBM Common
User Access (CUA) standards. However, since its end
product, the dBASE code, has to run outside of
Windows and still has to produce results that you got
when printing from Windows, FormCode/Gen has to do
a few things differently from most typical Windows
applications.
The biggest difference has to do with how you set up
your printer and how you print from Windows.
FormCode/Gen completely bypasses the Windows
device drivers for printing forms from Windows. This
gives us two advantages: The printing speed is orders
of magnitude faster, and the forms print identically from
within Windows or from outside windows (i.e from
dBASE). The disadvantage is that the printer setup is
local to FormCode/Gen and has nothing to do with the
printer setup of Windows, and that you can not use the
print manager when printing from FormCode/Gen.
There are a few other differences which are mainly there
because neither Windows nor the IBM CUA specifies
some functions that we believed are important. So we
implemented them. If you don't like things that don't
comply with the CUA spec, just don't use these
features, but we bet you will.
The first one is aborting a stretch or draw operation: In
most Windows applications, if you have started a
stretch or draw operation by pressing the mouse button,
you can not abort it. With FormCode/Gen, you simply
press Esc to abort the operation in the middle.
The second one has to do with the mouse right key. We
use it for de-selecting objects. You can de-select single
objects by right clicking on them, or you can de-select
by area.
The third one is that FormCode/Gen allows you to move
the cursor out of the edit window even during
operations such as stretch, draw, or move. This allows
you to use the scroll bars in the middle of a stretch or
draw operation. You could even move or re-size the
window in the middle of such operation. However, you
should refrain from using menu commands while in the
middle of such operations. The primary purpose of this
implementation is to allow the user to use the scroll bars
in the middle of operations. Most windows programs do
not allow you to do this, however, we felt that this
allows greater ease in editing so we implemented it.
PRINTING FROM WITHIN WINDOWS:
The forms you design will be destined to printing from
dBASE eventually. Certainly, however, you are going to
want to print them from within Windows in your design
phase. Since FormCode/Gen needs some extra
information that the Windows device drivers do not
provide, you need to make sure that an extra printer is
installed as described in the Installation Section.
The other important thing to remember when printing
from Windows is that you can not use the Windows
Print Manager to print from FormCode/Gen in Windows.
The Print Manager must be turned off from the
Windows Control Panel by first clicking on the printer
icon and then un-checking the Use Print Manager check-
box when the printers dialog appears.
CODE GENERATION STRATEGY:
Program Files: FormCode/Gen deals with three
different files when generating code: PCLDRV.PRG,
<design>.PRG, and <design>.MPG, where <design>
is the name of your design.
The PCLDRV.PRG file contains the low level printer
driver routines. All generated code makes calls to
procedures in this file. The procedures in this file remain
fixed. Depending upon which option you selected from
the File Menu, Page Setup command, the contents of
this file either get appended to the generated program in
<design>.PRG, or a SET PROCEDURE TO PCLDRV
statement is generated to make these procedures
available to the generated code. Which option works
best for you will be determined by which dBASE system
you are using (dBASE, Fox, Clipper, etc), and how many
designs you deal with, etc.
The <design>.MPG file contains the main program.
When you first create a design, select the Generate
Template Main Program option from the Page Setup
dialog (the default). Having this option checked will
make FormCode/Gen generate a template main program.
You can modify this generated template main program
in the <design>.MPG file. However, after you have
made changes, make sure that you un-check the
Generate Template Main Program check-box from the
Page Setup dialog box so that your changes do not get
overwritten. FormCode/Gen can only generate a
template main program. In almost all cases you will have
to modify the generated main program to include code
for opening database files, setting indexes and relations,
and defining the query.
FormCode/Gen combines the code contained in the
<design>.MPG file with the generated procedures into
<design>.PRG. This allows you to make any changes
that you may wish to make in the <design>.MPG file.
When code is generated, the contents of
<design>.MPG automatically get included in the
<design>.PRG file thus combining hand written code
with generated code!
Understanding the Generated Code:
FormCode/Gen generates several procedures for your
design. The procedures FCGINIT, FCGFIXOBJ, and
FCGVAROBJ are always generated. Other procedures
such as FCGTBROWn and FCGTBENn are generated
only if the design contained any table objects.
FCGINIT defines and initializes all global variables. All
global variable names begin with FCG and are therefore
easy to identify and purge using the RELEASE ALL LIKE
FCG* command.
FCGFIXOBJ draws all fixed objects in the design. Fixed
objects include lines, boxes, static text, and table
borders, etc. FCGVAROBJ draws the variable objects,
i.e field text and table data. If you selected the Use
Printer Macros check-box from the Page Setup dialog
box, FormCode/Gen
will define and use a printer macro for all objects that
FCGFIXOBJ draws. The procedures FCGFIXOBJ,
FCVAROBJ, FCGTBROWn, etc, all contain low level
information such as sheet coordinates, etc, for your
design. You should never modify these procedures since
your changes will be lost when code is re-generated.
If your design contained any table objects,
FormCode/Gen will generate either one or two
procedures for each table, depending on whether the
table had a totals row. These procedures are called
FCGTBRWn, and FCGTBENn where n is a unique
number that FormCode/Gen arbitrarily assigns to each
table. FCGTBRWn prints the specified row of the table
identified by n (e.g FCGTBRW0 is used to print one row
of table 0), and FCGTBENn prints the totals column for
table n. The remaining parts of the table such as the
border and background pattern, etc, are printed from
FCGFIXOBJ along with other fixed objects.
These procedures (i.e FCGFIXOBJ, FCGVAROBJ,
FCGTBROWn, etc) themselves, however, are not self
contained. That is, they do not generate the escape
sequences needed to driver your printer. Instead, they
make calls to procedures in the printer driver library file.
The name of the file that contains the library procedures
is PCLDRV.PRG, and it comes on your distribution disk.
The procedures in this file must be accessible to the
calling procedures. FormCode/Gen makes sure that
these procedures are accessible either by generating a
'SET PROCEDURE TO PCLDRV' in the main program or
by actually copying the contents of PCLDRV.PRG into
the generated code. Which action is taken depends on
whether the Append Procedures From PCLDRV.PRG
check-box in the Page Setup dialog was checked or not.
If you un-check the Append Procedures From
PCLDRV.PRG check-box in the Page Setup dialog box,
the generated code will not contain the procedures from
PCLDRV.PRG. Instead a SET PROCEDURE TO PCLDRV
statement will be generated in the main program. This
will make all procedures in the PCLDRV.PRG file
accessible to the main program. However, on some
systems (for example dBASE III Plus, FoxBase Plus, etc)
the procedures FCGFIXOBJ and FCGVAROBJ
themselves will now not be accessible to the main
program. This approach will therefore not work on these
systems.
One more important aspect of generated code that you
need to understand is the use of global variables.
FormCode/Gen uses variable and procedure names that
start with the letters FCG. This keeps them separate
from all user variables and procedures. Some of the
variables that the program uses are global variables so
they take up space even when printing is done. A simple
solution for this problem is to delete all variables that
start with FCG using the command: RELEASE ALL LIKE
FCG*, which deletes all memory variables that start
with FCG. This, however, should be done only after all
the printing procedures have been executed.
The following example contains a main program as it
was generated by FormCode/Gen followed by a
modified version of the same program. Following the
program is a line by line explanation of the code. (Note:
Some long lines wrap around):
1: * This is the template main program
2: * Upon code generation, it is placed in the
file with the .MPG extension.
3: * From there it is included in the .PRG file
along with other generated
4: * procedures.
5: * You should modify this main program to add
necessary statements for
6: * opening databases, initializing and
increment variables, etc. Make all
7: * changes to the .MPG File and NOT the .PRG
file. Also, after you have
8: * modified the .MPG file, un-check the
"Generate Template Main Program"
9: * from the File->PageSetup dialog box. This
will keep the .MPG file from
10: * being overwritten by FromCode/Gen
11: SET TALK OFF
12: * Comment out the next line for debugging.
13: SET CONSOLE OFF
14: SET PROCEDURE TO INV
15: DO FCGINIT
16: SET PRINT ON
17: DO FCGSTART WITH 1, 0, 2, 4, 300
18: ?? FCGRSTVAR
19:
20: FCGPAGE = 1
21: DO WHILE FCGPAGE <= 1
22: DO FCGFIXOBJ
23: * Code for printing table 0.
24: FCGTBROW = 0
25: DO WHILE FCGTBROW < 6
26: DO FCGTBRW0 WITH FCGTBROW
27: * Do all variable assignment, file
pointer movement, etc, here.
28: FCGTBROW = FCGTBROW + 1
29: ENDDO
30: * Make sure all totals fields are up to
date at this point
31: DO FCGTBEN0
32: DO FCGVAROBJ
33: * Do all variable re-assignments, file
pointer movements, etc, here.
34: ?? chr(12)
35: FCGPAGE = FCGPAGE + 1
36: ENDDO
37: DO FCGEND
38: SET PRINT OFF
39: SET CONSOLE ON
40: RETURN
Lines 1- 10: Comments generated by FormCode/Gen.
Line 11: Talk must be turned off during printing!
Line 13: Setting console to OFF keeps the PCL escape
sequences from being echoed on the screen. However,
it helps to turn this option on while debugging,
otherwise system messages and prompts don't get
displayed either.
Line 14: This line makes all procedures in this file
accessible to the main program which is also contained
in this file. This is unnecessary for some systems such
as FoxPro since FoxPro will automatically find any
procedures contained in the same file as the main
program. So for FoxPro you can delete this line.
Line 15: FCGINIT initializes all global variables for the
printing routines.
Line 16: Directs output to printer.
Line 17: Creates the job set-up string by calling
FCGSTART. Parameters passed are number of copies,
orientation (portrait), paper size (letter), paper source
(lower tray), and graphics resolution (300 DPI, currently
unused). The values passed to FCGSTART come from
the settings of the Page Setup dialog but can be
changed at run time. For example, you could prompt the
user for the number of copies and the paper source and
then pass these values to FCGSTART.
Line 18: Sends the printer control string created by
FCGSTART to the printer.
Lines 20 & 21: Start a dummy loop for printing a
number of pages; in this case one.
Line 22: Prints all fixed objects in the design such as
lines, boxes, table borders, etc.
Lines 24 & 25: Start a dummy loop for printing a
number of table rows; five in this case.
Line 26: Prints all columns in the specified table row.
Line 28: Increments the table row counter.
Line 29: Ends the table loop.
Line 31: Prints the totals row in the table.
Line 32: Prints all other field text in the form.
Line 34: Send a form feed to the printer.
Line 35: Increments the page counter.
Line 36: Ends the main loop.
Line 37: Sends the job termination command to the
printer setting the printer state back to it's default
value.
Lines 38, 39, 40: Clean up and return. You could add
another statement such as RELEASE ALL LIKE FCG* at
this point to free all memory variable created by the
FCGSTART routine.
The following lines show a modified version of the code
listed above. This example is typical of the type of
modifications that you will make to the code. In this
example it is assumed that the form was designed using
fields from two related databases, CUSTMERS and
ORDERS. The CUSTMERS database contains customer
information such as name, address, phone number, etc,
and the orders database contains recently taken orders
from these customers. The form was designed using a
table element for printing individual orders for
customers. This design is contained in your distribution
disk in file INV.FCG and INV.MPG. The databases are
also on the distribution disk. The design only uses
courier 10 and 12 point fonts so it should print on most
LaserJet compatible printers without problems.
Following the code is a line by line explanation of the
program.
1: SET TALK OFF
2: SET CONSOLE OFF
3: SET PROCEDURE TO INV
4: DO FCGINIT
5: SET PRINT ON
6: DO FCGSTART WITH 1, 0, 2, 4, 300
7: ?? FCGRSTVAR
8: select 1
9: use custmers
10: set safety off
11: index on cust_num to cust_num
12: select 2
13: use orders
14: set relation to cust_num into custmers
15:
16: DO WHILE .not. eof()
17: DO FCGFIXOBJ
18: FCGTBROW = 0
19: mTOTAL = 0
20: mCUSTNUM = cust_num
21: DO WHILE cust_num = mCUSTNUM
22: DO FCGTBRW0 WITH FCGTBROW
23: FCGTBROW = FCGTBROW + 1
24: mTOTAL = mTOTAL + cost
25: skip
26: ENDDO
27: mAPPREC = "We apraciate our customers!"
28: if (mTOTAL > 500)
29: mAPPREC = "You are one of our very
special customers!!"
30: endif
31: if (mTOTAL > 1000)
32: mAPPREC = "You are one of our best
customer!!!"
33: endif
34: DO FCGTBEN0
35: skip -1
36: DO FCGVAROBJ
37: skip
38: ?? chr(12)
39: ENDDO
40: DO FCGEND
41: SET PRINT OFF
42: SET CONSOLE ON
43: RETURN
Lines 1 - 7: Remain unchanged from the generated
code.
Lines 8 - 11: Opens the CUSTMERS database and
creates the needed index file for this database. The
index is created from scratch in this example to provide
all users an index compatible with their system since
most dBASE systems use their own unique index
structures.
Lines 12 - 14: Open the second database and set the
necessary relation.
Line 16: Starts the loop for scanning all records in the
orders database.
Line 17: Prints all fixed objects in the design such as
lines, boxes, static text, and table borders, etc.
Lines 18 - 20: Initialize the memory variables needed for
printing the table.
Line 21: Starts the loop for processing all orders
belonging to the same customer.
Line 22: Prints all columns in the specified row of table.
Line 23: Increments the table row counter.
Line 24: Updates the memory variable that keeps track
of the sum of the COST field.
Line 25: Moves the record pointer in the ORDERS
database to the next record.
Line 26: Ends the loop for printing table rows.
Line 27 - 33: Set the value of the memory variable
mAPPREC to a string based on the results of summing
the COST field in the ORDERS database.
Line 34: Prints the totals row in the table. The totals
row was designed using the memory variable mTOTAL
which at this point contains the total cost of all orders.
Line 35: The record pointer at this point has moved to
orders for the next customer so move it back to the
current customer before printing the rest of the form.
Line 36: Prints the rest of the field text in the form. The
customers name, address, etc., and the appreciation
string get printed here.
Line 37: Move record pointer to orders for the next
customer.
Line 38: Sends a form-feed to the printer.
Line 39: Ends the main program loop for printing forms.
Line 40: Sends the printer reset command to the printer
resetting the printer to its default state before the job
started.
Lines 41 - 43: The normal ending sequencing.
The code presented in this section was from a design
that uses a table object to print tabular data. If your
design does not contain the table object, the generated
code will be a lot simpler.
SCREEN LAYOUT:
The screen layout for FormCode/Gen is typical of most
Windows applications. The left hand column, starting
from the top, contains icons for the form design objects
described below. Below these icons are the Zoom In and
Full Page buttons. Below these buttons are displayed
the default settings for box, line, and text objects. The
big window in the middle is the edit window. Below the
edit window is a status line that displays the current
cursor position, number of objects currently selected,
and the current grid setting.
DESIGN UNITS:
FormCode/Gen uses one hundredth of an inch as its
basic design unit. All widths, etc, entered by the user in
dialog boxes must be in this unit. For example 1/4 of an
inch is entered as 25. Do not enter decimal numbers
such as 1.5 for one and a half inch. One and a half inch
should be entered as 150. However, the program
displays the current cursor position in decimal inches (eg
1.33, etc) on the status line.
FORM DESIGN OBJECTS:
Forms in FormCode/Gen are designed using six basic
design objects. These objects are: Boxes, Lines, Text,
Tables, Check-boxes, and Bitmap Images. A complete
discussion of each object in detail is given later in this
manual. This section briefly describes the objects:
Boxes can make a form look beautiful and help form
groups of related data. The user can specify the type of
border, border thickness, inside fill pattern, and shadow
for boxes.
Lines can be drawn horizontally and vertically, but not
diagonally, and the user can specify the line thickness.
Text can be either static text or a text field (field here
means database field, variable, or expression). The user
can specify the font and foreground pattern/shade for
text. Text can be single line or multi-line. Text is always
enclosed in an enclosing box. If you do not want the
box, simply give it a border width of zero and no fill.
FormCode/Gen allows text to be left, right, center, or
left/right justified. If the text is field text, justification
will be performed at run time since the actual contents
of the text field are not known until run time. Run time
justification, however, takes its toll both in terms of
speed and memory.
Check-boxes allow a more user friendly representation
of true/false data. In the current version of
FormCode/Gen, check-boxes are of fixed size. The user
only specifies the logical expression for the check box.
If the logical expression evaluates to a true, the box will
be checked, otherwise it will remain empty.
Tables are a very powerful way of allowing you to build
rows and columns of data. A variety of different border
types can be specified - including no border at all.
Tables may or may not have a table title, column titles,
and a totals row. Each table column can have its
different font, background and foreground pattern,
margins, etc. It is also very easy to design tables with
alternating background patterns.
The last form design object is a bitmap image.
FormCode/Gen itself is not an image design package. It
is assumed that images will be designed in other
presentation graphics and/or desk-top publishing
packages (such as Micrografx Designer, Aldus
PageMaker, Ventura Publisher, etc) and then imported
into FormCode/Gen. Images can also be obtained from
a variety of scanning devices and their accompanying
software. The only format currently available for
importing bitmap images into FormCode/Gen is the Tag
Image File Format or TIFF. However, since TIFF is so
universally available, this does not pose any serious
restrictions on the user.
BASIC DESIGN PROCEDURES:
This section describes the basic editing procedures that
you will use for designing forms. A detailed description
of all the menu commands follows. The basic editing
procedures used in FormCode/Gen are the same as in
other Windows graphics applications. The only features
unique to FormCode/Gen are the aborting of stretch
and/or draw operations using the Esc key and the use of
the right mouse button for de-selecting selected objects
one by one or by area. The following paragraphs briefly
describe the basic editing procedures:
Drawing Objects: All of the form design objects
(boxes, lines, text, etc) can be drawn by first clicking on
the corresponding objects' icon in the object window.
This will highlight the current design object by reversing
its video rendition. Now move the cursor to the edit
window and press the mouse left button where you
want one corner of the object. Drag the mouse to where
you want the other corner of the object and release the
left button. This procedure applies consistently to all
design objects including text, tables, and bitmaps.
Some objects, such as lines and boxes, are drawn
instantly as you release the mouse button, while others,
such as text and tables, pop up a dialog box to be filled
with information before the object is drawn.
Also, some objects, such as tables, de-select their
object icon in the design object window on the top left
side of the screen while others leave it selected allowing
you to continuing drawing more objects of the same
type without clicking on the object icon each time. This
is done to convenience the user. Frequently drawn
objects, such as boxes and lines, leave their icon
selected so more boxes and lines can be drawn quickly.
Infrequently drawn objects, such as tables, de-select
their icons putting the user back in edit mode to
continue editing.
To quit the object draw mode and get back to edit
mode, simply click in the space below the form design
objects. When none of the form design objects is
highlighted, you are back in edit mode.
Zooming and Panning: FormCode/Gen provides two
levels of zoom; full page and zoomed in. For form design
these two levels give enough flexibility to the user. To
change from one zoom mode to the other simply click
on its button. The Full Page button takes effect
immediately and the display is updated as soon as you
press the button. The Zoom In button does not zoom in
immediately. Instead it presents you with a zoom
rectangle as you move the cursor back to the edit
window. Move the zoom rectangle to the objects that
you want to zoom in on and then click the mouse left
button to zoom in.
Panning works exactly as it does in all Windows
applications by using the scroll bars next to the edit
window.
Selecting Objects: You have two different ways of
selecting objects: A single object can be selected by
clicking the mouse left button when cursor is on the
object. If the shift key is pressed while clicking on the
object, other objects that were already selected remain
selected and the new object is also selected, otherwise
previously selected objects are de-selected. Several
objects can be selected together by moving the cursor
to one corner of the window, pressing the left button,
and then moving the cursor to the other corner while
keeping the left button pressed. As the left button is
released, all objects that fall completely inside the
stretch box will be selected and everything outside the
box will be de-selected.
You may encounter difficulty selecting objects some
times. This is especially true when you have overlapping
objects and/or smaller objects that are completely inside
larger objects. The object in front gets selected when
you may be trying to select the object behind it. Simply
click again without moving the mouse to select the
object behind. If you have several overlapping objects,
keep clicking without moving the mouse and each
object will be selected in sequence till you reach the last
object under the cursor. Another solution is to make
some large objects unselectable by editing their
definition. This will keep them completely out of your
way while editing. You could also use the Edit Menu,
Move to Back command to move the larger object
behind the smaller object and out of the way.
De-Selecting Objects: De-selecting works identically
to selecting except that you use the right mouse button
instead of the left. An Individual object can be de-
selected by clicking on the object, or several objects at
a time can be de-selected by using the area de-select
operation.
Moving Objects: Objects can be moved one at a
time, or several objects can be moved together. To
move a single object, de-select everything else and then
press the mouse left button after moving the cursor on
top of the object that you wish to move. The object can
be dragged by moving the mouse while the button
remains pressed. The move is completed by releasing
the button or aborted by pressing Esc.
Several objects can be moved together by first selecting
the objects that you want to move and then pressing
the mouse left button on any one of these objects. Drag
the objects to the desired position while keeping the
button pressed.
Stretching Objects: Objects can be stretched in any
direction by first moving the cursor to the corner of the
selected object where stretching is to take place. When
cursor is in its proper stretch position, the cursor shape
will change. Press the mouse left button and stretch the
object while keeping the button pressed. Release the
button to complete the stretch operation, or press Esc
to abort.
Objects can be stretched within legal limits only. In
particular, you can not stretch objects to a size smaller
than possible for the object. The smallest possible size
is determined by the type of object that you are
stretching. For example, for a text object, the smallest
size is determined by the actual text string, the size of
the font, the number of lines of text, and the margins.
Editing Object Definitions: You can edit the
definition of form objects by double clicking on the
object with the mouse left button. This will bring up a
dialog box for editing the objects definition. Some
objects, bitmap images for example, have no definition
that can be edited. Double clicking on these objects will
do nothing.
MENU DESCRIPTIONS:
Following is a description of all menu commands
available in FormCode/Gen. There are four pull-down
menus that the program uses namely, File, Edit,
Alignment, and Settings.
The File Menu: The File Menu has the following
commands:
New: Clears the previous design and starts a new form
or label design. The user is prompted for the type of
design, either form or label.
Open: Opens a previously saved design. FormCode/Gen
files have an extension of .FCG. The open dialog works
just like any Windows open file dialog box.
Save: Saves the current design in file. If the design has
not yet been given a name, the user is prompted to
enter a name for the design.
Save As: Saves the current design under a different file
name.
Gen Code: Generates dBASE code for the current
design. This is the end result of FormCode/Gen. The
generated code is placed in a file that has the same
name as the design itself and has an extension of .PRG.
If the design contained any bitmap images, a separate
file is generated for each image. These files have the
same names as the TIFF files that were read in, but they
have an extension of .PCL since they contain PCL
commands to print the image. These files must be
distributed along with the .PRG file. Also, the image
files are placed in the same directory where the design
file is saved even if the original TIFF files were opened
from different directories. This allows convenient
distribution of the image files.
Also, before you can generate code, you must have an
additional printer identical to your default printer
installed from Windows. This printer should be
connected to FCG.TMP from the ports selection menu.
For more information on this, read the section on
Installation and Setup.
Check Sheet: Checks the design for design error such as
objects that are outside the sheet boundaries. If such
objects are reported by FormCode/Gen, the Toggle
Select command can be used to select and delete these
objects.
Print: Prints the current design to the default Windows
printer. The default printer can be changed from the
Windows Control Panel. You must disable the Windows
Print Manager while printing from FormCode/Gen. Also,
you must have an additional printer identical to your
default printer installed from Windows. This printer
should be connected to the FCG.TMP pseudo port from
the ports selection menu. For more information on
these, read the section on Installation and Setup.
Even though the default printer is set from the Windows
Control Panel (and must be set before starting
FormCode/Gen), the program ignores all other settings
of the default printer such as paper source, orientation,
etc. These settings are obtained from the page setup
inside FormCode/Gen. The page setup menu is explained
below.
Page Setup: This menu has all the options that apply to
the overall design, such as paper size and bin,
orientation, number of copies, etc. FormCode/Gen saves
all of these settings in the design file along with all other
design data. These settings take precedence over the
printer setup that is set from the Windows Control
Panel.
Selecting the Use Printer Macros option will cause
FormCode/Gen to generate code that defines and uses
printer macros for all fixed objects (lines, boxes, bit-
maps, etc) in the design. Choosing this option can
significantly increase printing speed, especially if your
printer is connected to a slow serial port. However, this
speed is gained at the expense of printer memory. If
your printer does not have enough memory, using this
option may result in printer errors.
Checking the Generate Template Main Program will
make FormCode/Gen generate a new template main
program for your design upon code generation. This
template main program is first placed in the file
<design>.MPG and then from there it is also included
in the <design>.PRG file, where <design> is the
name of your design file. Normally, you will select this
option after first creating a design to generate a
template main program. You would then modify the
template program in <design>.MPG and also un-check
the Generate Template Main Program option to keep
your modifications from being overwritten by
FormCode/Gen.
The Append Procedures From PCLDRV.PRG option tells
FormCode/Gen whether or not to append printer driver
routines from the driver library file into the generated
code. If this option is un-checked, the procedures are
not physically copied from the driver file but instead a
SET PROCEDURE TO PCLDRV statement is generated
making these procedures accessible to the generated
routines. This produces smaller code, however, it will
only work for some dBASE systems (for example
FoxPro) and not for others (for example FoxBASE Plus).
Label Setup: This menu sets all label parameters if the
design is a label. If the design is a form rather than a
label, this menu command remains disabled.
Open DBF: You can open up-to 50 database files at a
time for placing fields in your design. If any databases
are open, the Build... button in text and table dialogs is
enabled. This allows you to select fields from the
databases to build text and table expressions.
Memory Left: Displays the amount of memory currently
available to Windows. This memory, however, can be
used by other applications running concurrently also. If
the amount of memory is low (below 300K) you may
want to consider closing some of the other applications.
Exit: terminates the program after prompting the user to
save any unsaved edits.
About: Displays copyright and version information for
FormCode/Gen.
The Edit Menu: The Edit Menu has the following
commands:
Delete: Deletes all selected objects. The objects are not
placed on the clipboard, and are lost forever.
Cut: Copies all selected objects from the design to the
clipboard and deletes them from the design. Note that
FormCode/Gen uses a private clipboard rather the
Windows global clipboard. This is because the data from
FormCode/Gen is not in any of the formats that most
Windows applications can understand, so it would be
pretty worthless to place the data on the Windows
clipboard.
Copy: Copies all selected objects from the design to the
clipboard without affecting the design. Note that
FormCode/Gen uses a private clipboard rather the
Windows global clipboard. This is because the data from
FormCode/Gen is not in any of the formats that most
Windows applications can understand, so it would be
pretty worthless to place the data on the Windows
clipboard.
To copy objects from one design to another, simply use
the copy command to copy the selected objects to the
clipboard. Then open the new design file and paste from
the clipboard.
Paste: Pastes objects from the local clipboard into the
current design. Objects are placed on the clipboard
using the Cut or Copy command. Objects are placed at
a slight displacement from their original position, i.e the
position they were at before cutting or copying, in the
design.
Move To Back: Moves the currently selected object
behind all other design objects. All other objects retain
their relative positions with respect to each other. As
new objects are placed in the design, they are placed on
top of existing objects. This command may be
necessary to change this default order.
Move To Front: Moves the currently selected object in
front of all other design objects. All other objects retain
their relative positions with respect to each other. As
new objects are placed in the design, they are placed on
top of existing objects. This command may be
necessary to change this default order.
Group: Objects can be made part of a group of objects.
When an object that belongs to a group is selected, all
other objects in that group are also selected. To group
several objects together, first select them, and then use
the group command. If any of the selected objects
belonged to another group previously, they loose their
membership in the old group.
Un Group: Removes all selected objects from their
groups, if any.
Toggle Select: Selects all objects that are currently not
selected, and de-selects all objects that are currently
selected. This command can be very useful for selecting
objects that get outside the sheet boundaries and
become out of sight. For example to select all design
objects that are outside the sheet boundary and thus
out of sight, first select all objects inside the sheet
boundary by using the area select command over the
entire sheet, and then use this command to select all
objects that are outside the sheet limits.
The Alignment Menu: The Alignment Menu has the
following commands:
Center on Horz: This command works differently
depending on how many objects are selected. If only
one object is selected, it will be centered horizontally on
the page. If two or more objects are selected, the
smaller objects will be centered horizontally inside the
largest object. The position of the largest object remains
unchanged.
Center on Vert: This command works differently
depending on how many objects are selected. If only
one object is selected, it will be centered vertically on
the page. If two or more objects are selected, the
smaller objects will be centered vertically inside the
largest object. The position of the largest object remains
unchanged.
Snap X to Grid: Snaps the left and right sides of all
selected objects to the nearest grid point. The top and
bottom sides remain unchanged.
Snap Y to Grid: Snaps the top and bottom sides of all
selected objects to the nearest grid point. The left and
right sides remain unchanged.
Mark Align Ref: Marks the currently selected object as
a reference point for alignment. The actual alignment is
performed using the Align Left/Top/Right/Bottom
commands explained below.
Align Left: This command works in conjunction with the
Mark Align Ref command. The Mark Align Ref command
is used to mark one object as a reference point. This
command, when followed by the Mark Align Ref
command performs the actual alignment by aligning all
currently selected objects to the left side of the
reference object.
Align Top: This command works in conjunction with the
Mark Align Ref command. The Mark Align Ref command
is used to mark one object as a reference point. This
command, when followed by the Mark Align Ref
command performs the actual alignment by aligning all
currently selected objects to the top side of the
reference object.
Align Right: This command works in conjunction with
the Mark Align Ref command. The Mark Align Ref
command is used to mark one object as a reference
point. This command, when followed by the Mark Align
Ref command performs the actual alignment by aligning
all currently selected objects to the right side of the
reference object.
Align Bottom: This command works in conjunction with
the Mark Align Ref command. The Mark Align Ref
command is used to mark one object as a reference
point. This command, when followed by the Mark Align
Ref command performs the actual alignment by aligning
all currently selected objects to the bottom side of the
reference object.
The Settings Menu: The settings menu allows the
user to change all system settings and editing
preferences. All of these settings are stored in the
design file along with other design objects and restored
when a design file is opened. The Settings Menu has
the following commands.
Grid: Sets the horizontal and verticle grid. Grid units are
specified in hundredths of inches, so for example a half
inch grid is specified as 50 points. All edit and draw
operations snap to the nearest grid point. Even though
the cursor moves smoothly between grid points, the
coordinate display on the status line is in multiples of
the grid units.
Disp Grid: Turns on/off the displaying of the current
grid. Remember that objects snap to the current grid
setting regardless of whether the grid display is turned
on or off.
Disp Crosshair: Turns on/off the crosshair across the
edit window.
Rulers On: Turns on/off the rulers displayed on top of
and to the left side of the edit window.
Gravity On: When gravity is turned on, the cursor tends
to pull itself to grid points as if it were being attracted
to the grid points. When gravity is turned off the cursor
moves smoothly between grid points and can stop in
the middle of grid points. Gravity has no affect on how
drawing or editing actually works, it is simply a
preference on how the cursor behaves.
Show Text Ext: As explained in the section on What
You See is What You Get or WYSIWYG, FormCode/Gen
displays your design on the screen as accurately as
possible. However it is not always possible to find a
screen font that exactly matches the printer font being
requested and Windows uses the best match it can find.
On many occasions, this font will be significantly
different from the printer font in both size and style.
This is specially true, when dealing with unusual or very
small typefaces.
This commands turns on/off the display of the actual
extent of all text as it will be printed. The extent are
displayed by drawing blue color rectangles in the exact
positions where the text will appear when printed to the
printer.
Hide Images: Bitmap images are slow to draw, and can
significantly slow down editing speed. This command
turns on/off the display of all bitmap images. When
images are hidden, they are replaced with blue
rectangles that show their position but are much faster
to draw.
Box Defaults: Sets the defaults for box objects. All new
boxes are drawn using these settings. The new settings
are displayed in the status window in the lower left
corner of the display.
Line Defaults: Sets the defaults for line objects. All new
lines are drawn using these settings. The new settings
are displayed in the status window in the lower left
corner of the display.
Text Defaults: Sets the defaults for text objects. All
new text is drawn using these settings. The new
settings are displayed in the status window in the lower
left corner of the display.
Table Defaults: Sets the defaults for table objects. All
new tables are drawn using these settings.
DESIGN OBJECT DESCRIPTIONS:
FormCode/Gen provides the user with six basic design
objects for designing forms and labels. These objects
are Boxes, Lines, Text, Check-boxes, Tables, and
Bitmap Images. The following paragraphs describe all of
these objects in greater detail:
Box Objects: The use of boxes can dramatically
improve the appearance of any printed form. Boxes can
be used to group items together by placing them inside
boxes and also to contain other objects such as text and
bitmap images.
The user can specify the following parameters for
boxes:
Line Width: Specify line width in hundredths of inches.
For example enter 10 for one tenth of an inch. If no line
is desired, for example a box with shading only and no
border, enter a width of 0 (It would be pretty
meaningless to have a box with both no border and no
fill)
Fill Pattern/Shade: Boxes can have a fill pattern or gray
shade to fill the interior of the box. Select the fill by
using the scroll bar on the fill selector in the Edit Box
Definition dialog box. It is important to note that a fill of
White is not the same as a fill of none. A white fill
overwrites any objects under the box, whereas with a
fill of none, objects underneath the box remain visible.
Border Type and shadow: Boxes can have either a single
border or a double border and a shadow can be
specified for boxes.
Line Objects: In the present version of FormCode/Gen
lines can only be either horizontal or verticle. This is
because these are the only types of lines that can be
drawn on all HP Laser Printers before the Laser Jet III
without sacrificing speed. Since forms usually only have
horizontal or verticle lines, however, this should not
pose any serious problems.
The only parameter that the user specifies for lines is
the lines width. Specify the width in hundredths of
inches (e.g one tenth of an inch is 10 units).
Text Objects: FormCode/Gen provides a great deal of
flexibility in drawing text. All text is enclosed in an
enclosing box whose definition can be edited by the
user. If an enclosing box is not desired, simply give it a
width of 0 and a fill pattern of white or none.
Text is divided into two main categories: Field Text and
Static Text. Static text appears in your forms exactly as
it appears on the screen or as it is printed from
Windows. That is, the contents of the text object
remain the same. Field text on the other hand can be a
database field, variable, or any other expression that
evaluates to a character value in dBASE. Numeric, date,
and logical values must be converted to character.
Static text can be single line or multi-line. To enter
multiple lines of text, press Ctrl-Enter at the end of each
text line (simply entering Enter will close the dialog box).
As many lines of text as desired can be entered. The
selected justification applies to all entered lines.
Field text can also be single line or multi-line. However,
only the L/R justification, which justifies both left and
right, can be used with multi-line field text. The actual
number of lines in multi-line field text can only be
determined at run time, therefore the user should leave
enough room to fit the longest possible text. Multi-line
field text is extremely useful for printing memo fields in
FoxPro (1.0 and 2.0) and Clipper 5.0. Simply draw a
box large enough to contain the text, select L/R
justification and other options as desired, and enter the
name of a memo field as the text expression. That's all
there is to printing beautiful left and right justified text
that is automatically filled line by line from your memo
field! FormCode/Gen does run time filling and
justification.
The Edit Text Definition dialog box provides the user
with two separate edit boxes for entering text. The top
box is titled Enter Display Text:. In this box enter the
text as you would like Windows to display it while
editing. If the text object is static text then the display
text is also the actual contents of the text object. If,
however, the text object is field text, the display text is
only used to display the text from Windows, and also
for printing the form from within Windows. In this case
you may want to put some meaningful text as the
display text. For example, you can put your name where
a name database field appears.
Also, in the case of field text, the actual length of the
text remains unknown until it is printed from dBASE
using your data. Therefore make sure you leave enough
room to account for the longest possible values.
Another thing to keep in mind is that the extent of the
text can not simply be calculated based on the number
of characters since with proportional fonts different
characters have significantly different width.
Following is a description of other items in the Edit Text
Definition dialog box:
Field: Mark the check box to indicate that the text is
field text rather than static text. As long as the check
box is un-marked, you will not be able to enter anything
in the expression edit box.
Expr: If the Field check box is checked signifying field
text, this edit box can be used to enter the field
expression. The field expression must be a valid dBASE
expression and must evaluate to character type. The
Build.. button can be used to help build field
expressions.
Build...: This push button will be enabled if the text is
field text and any database files have been opened from
the File Menu. Click on the button to retrieve fields from
open database files to build the field expression.
Font..: Click on this push button to select the font for
the text. The list of fonts presented contains all the
fonts that have been installed from Windows. Select the
desired typeface, size, and style (bold and/or italic).
Box...: Click on this button to edit the definition of the
enclosing box for the text object. The Edit Box
Definition dialog appears. Editing box definition for text
boxes is identical to editing box definition for stand
alone boxes which is described above.
Pattern..: Click on this button to specify a foreground
pattern for the text object. The Edit Text Pattern dialog
box appears to allow you to select a pattern for drawing
the text.
Justification: Select the desired justification from Left,
Right, Center, or L/R. The justification is with respect to
the enclosing box, even if the box is not visible.
Margins: Specify the left, top, right, and bottom margins
in hundredths of inches (e.g 1/10 inch specified as 10).
Again, the margins are with respect to the enclosing
box. Text justification is performed inside the margins.
Table Objects: Tables provide a very convenient and
powerful way of presenting tabular data, i.e data that
falls in rows and columns. FormCode/Gen provides a
great deal of flexibility in the design of tables: Tables
can have single or double border, and for single border
the width for all the lines can be specified individually.
Tables may or may not have a title, and table columns
may or may not have a title and a total. Each column
can have its own font, background, margins,
justification etc. The following is a detailed description
of the table object:
A table is defined in terms of these items from the Edit
Table Definition dialog:
Table Title: A table may or may not have a title. Check
the Table Has Title check box to determine whether the
table has a title. If the check box is checked, the Edit
Title... button can be used to edit the title definition.
Column Title and Total Rows: The table may or may not
have a column titles row and a column totals row.
Check the desired check-boxes. The selections you
make will determine how the Edit Table Column dialog
box is presented.
Border Type: Select either a single or a double border. If
a single border is selected, you can define the widths of
individual lines that define the border. To do this click
the Define... button. All widths are entered in
hundredths of inches (e.g 1/10 of an inch is entered as
10).
Define Columns: Click on the various buttons in this
group box to edit the definitions of individual table
columns. At the top of the box are displayed the total
number of columns in the table and the current column.
The current column is the one whose definition is edited
by clicking on the Edit... button. You can insert and
delete columns at any position desired. Columns are
numbered starting at 0.
When the Edit Table Definition dialog first pops up, the
current column field will say All. This means that when
you click on the Edit... button you are editing column
definition for all columns. This is very useful for defining
common characteristics to all columns, such as font,
background, widths, etc. After the common
characteristics have been set for all columns, the
individual column definitions can be edited individual to
modify their unique characteristics.
Each table column is defined in terms of several things
such as width, background, and cell. These items are
defined from the Edit Table Column dialog which
appears when you edit a column. The following is a
more detailed description of items in this dialog box:
Column Width: Columns can have an absolute or
relative width. If absolute width is selected, the width
value is specified in hundredths of an inch. Absolute
width fixes the width of the specified column to the
entered value. Stretching the table will have no effect
on the width of absolute width columns, only relative
width columns will stretch.
For relative width columns, the value is interpreted as a
relative number. This can be looked at as a percent
number if the sum of all relative width columns is 100,
but it does not have to be a percent number. For
example, if the sum of all relative width columns adds
up to 300, then the widths of individual columns will
not be a percent value.
When the user stretches a table object, either when
creating a new table or when stretching an existing one,
FormCode/Gen calculates column widths as follows:
First all absolute columns are assigned their absolute
width, then the remainder amount is distributed over all
of the relative width columns proportionately by their
relative widths. If a table does not have any relative
width columns, it can not be stretched in the horizontal
direction. It has a fixed horizontal size. The minimum
verticle size of a table row is determined by the text
font being used, and the margins, etc.
Column Body Background: You can select a pattern and
or gray shade for each columns background. This
background can be applied to all rows in the column,
only the odd rows, only the even rows, or no rows at
all. This odd/even/none/all selection applies only to the
body of the that column. The actual pattern can be
select by using the Edit Body... button.
If columns have titles and totals, specified from the Edit
Table Definition dialog, the backgrounds of these titles
and totals remain unaffected by the odd/even/none/all
selection. This selection only applies to the body part of
the column.
Edit Title, Body, Total: These push buttons allow you to
edit the title, body, or totals cell for a table column. The
title, and total buttons will be enabled only if table has
column titles and totals. These cells define the text font
to be used, the justification for the text, the margins,
the text foreground pattern, and the cell background
pattern.
For the title cell the entered text is treated as static text,
i.e it appears literally in the printed form. For the body
and totals cells, the text is treated as a text expression.
The expression could be a database field, variable, or
any other valid dBASE expression that evaluates to a
character value. Expressions that do not evaluate to
character values, such as numeric, date or logical, must
be converted to character type.
When a table is printed from Windows, its cells contain
the cell numbers for text. The actual text will be
displayed when the table is printed from dBASE.
Check-box Objects: Check boxes provide a more
attractive way of presenting logical data. The user
specifies an expression for each check-box. This
expression can be a database field, memory variable, or
any other valid dBASE expression that evaluates to a
logical value. If the expression evaluates to a true value,
a check-mark is placed inside the check-box. Otherwise
the check-box remains empty.
When printed from Windows, check-boxes are always
printed with a check-mark in them since the logical
expression can not yet be evaluated.
Bitmap Image Objects: Bitmap images can be
included in forms designed with FormCode/Gen.
However, this software itself is not meant to be a
graphics image design package so no image editing is
possible. Images can be edited with other graphics/desk-
top publishing packages and then brought into
FormCode/Gen. Images can also be obtained from a
variety of scanners. Typically the images brought into a
design will be logos, etc.
Upon code generation, FormCode/Gen creates a
separate file with a .PCL extension for each imported
image in the design. This file contains the pre-processed
image and must be distributed along with the .PRG file
generated.
The user needs to understands a few things about
images before using this feature. Some of this
knowledge will help you in selecting proper options
when options when generating images from your
imaging software.
Images can be brought into designs by reading Tag
Image Format files or TIFF files. At present, this is the
only format that FormCode/Gen can understand.
However, TIFF is such a universal format that this does
not put any serious limitations on the variety of images
that can be brought in. FormCode/Gen supports the full
class B of TIFF files. In particular, this means that it is
capable of reading monochrome images and allows
unpacked as well as compressed images using Pack Bits
and CCITT 1D compression schemes.
When generating TIFF files from scanner or imaging
software two things must be taken into consideration:
The resolution of the image and half-toning. Both of
these are described in greater detail in the following
paragraphs:
Most imaging and scanner software packages can
produce TIFF images with a variety of resolutions. For
scanners the resolution typically is 75, 150, or 300 dots
per inch. All of these are acceptable resolution values
for HP Laser Jet and compatible printers and
FormCode/Gen will accept any of them without any
problems. The higher the resolution, the better the
quality of the image will be, but at the same time the
larger the image file size will be and the slower to print
the image will be.
Most imaging and graphics packages will also give you
an option for specifying image resolution. If your
package allows you to select from printer or screen
resolution, select printer resolution. Images written at
screen resolution may not print very well, and will
certainly not be of the right size.
Another factor to consider for images is half-toning or
dithering. Both of these are methods of simulating
shades of gray on printers that can only print black
dots. Imaging packages and scanner software can take
an image that was originally designed with or scanned
from a colored or true gray scale image and write it to
a TIFF file as a monochrome image by performing half-
toning or dithering on it. FormCode/Gen itself does
neither dithering nor half-toning of images. So this step
must be performed at the source. Some imaging
packages will only let you specify the type of TIFF file
as Monochrome, Color, or Gray-scale. If you were
exporting (i.e generating a TIFF file) for a colored or
gray-scale image and specified monochrome as the
output type, most of the good packages will
automatically do half-toning or dithering before writing
the image out as a monochrome bitmap.
FormCode/Gen prints images from dBASE by sending a
pre-processed version of the image (contained in a file
with the .PCL extension) directly to the printer. The
reason for using this approach is that dBASE does not
have any other means for sending binary data to the
printer without intervening with the data. In the supplied
printer driver library, the file is copied to the printer
using the DOS copy command in procedure FCGIMAGE.
The /b switch is used to keep DOS from interpreting the
data as an ASCII file and must be specified. The copy
command copies the file to the DOS PRN device. By
default DOS treats PRN as LPT1. If your printer is not
connected to LPT1, you can either change the copy
command or use the DOS MODE LPT1=XX command
in your AUTOEXEC.BAT file to redirect all output from
the PRN device to the true physical device that your
printer is connected to (e.g COM1). You must edit the
FCGIMAGE procedure in the PCLDRV.PRG file to reflect
the port that your printer is connected to. On systems
other than DOS, such as Novel, Unix, etc, you will
probably need to change the copy command itself also
not just the printer port. For example in Unix the
command may look like: cp pict.pcl /dev/prn.
The following are registered trade marks of their
respective owners: dBASE (Ashton Tate Corp.),
FoxPlus/FoxPro (Fox Software Inc.), Clipper (Nantucket
Corp.), LaserJet (Hewlett Packard Corp.), Aldus
PageMaker (Aldus Corp), Novel (Novel Inc.), Unix (AT&T
Corp.).