home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
BASIC
/
MKFORM
/
MAKEFORM.DOC
< prev
next >
Wrap
Text File
|
1994-03-28
|
50KB
|
1,076 lines
MAKEFORM
Merlin's Application Framework
MANUAL
(C) Merlin's Software
P.O.Box 473
Zeist NL-3700-AL
THE NETHERLANDS
MERLIN'S SOFTWARE
It's Magic!
Software for Witches, Wizards
and other creative people.
P.O.Box 473 - Zeist NL-3700-AL - The Netherlands
If you had a magic wand, wouldn't you banish all computers, and all red
tape, and move to a nice warm sunny country? Dance in the moonlight, com-
municate with the fairies, sip a glass of wine with some good friends, and
simply enjoy life?
It isn't human destiny to sit behind a silly computer screen and punch
buttons... But if we have to, let's at least remind ourselves of the Dream
Time that our Inner Self longs for...
Merlin's Software develops computer programs that put some of the magic,
the creativity and the fun of being alive into the software.
Just as we surround ourselves in our home with objects that express our
innermost feelings, and wear clothes that reflect our outlook on life, so
too software should be an extension of our personality. There is no reason
why everyone should use the same overweight elephantware and conform to
the same standard of drab office grey now, is there?
Merlin's Software tries to achieve this goal by:
developing deluxe graphical applications that go beyond simple func-
tionality and incorporate beauty and creativity.
developing custom software and modules.
developing programming tools and utilities for other creative devel-
opers.
If you have specific needs or creative ideas, and want a completely free
evaluation (no strings attached), please get in touch with Merlin's
Software!
Life is supposed to be FUN!
Dennis ten Siethoff
Contents
General Section
The Story So Far ...
Overview
Application Framework
ShareWare
Technicalities & Legalese
Credits
Quick Start
PCX files
MakeForm Overview
Starting MakeForm
Design Stage
Data Entry Screen
Test Run
Save Your Work
Exit MakeForm
Completing Your Program
Reference Section
Text Fields
Push Buttons
Mouse Fields
Scroll Bars
List Boxes
Creating a Menu System
Advanced Section
Event Driven Programs
A Small Tutorial
Out Of Memory
Working With The Code
Messages
Asking Questions
Input! Need Input!
Save Yourself!
Show Yourself!
Various Routines
Advanced Coding
Object Structure
Adding Custom Objects
Altering Existing Objects
Appendices
Library Documentation
Batch File Editor - an example
The Story So Far ...
You settle back in your chair in the main hall. The presenter opens his
laptop, switches on the small light next to him, and taps on the micro-
phone.
"Welcome to Merlin's Graphical Application FrameWork! Say goodbye to all
the tedious coding to get a nice push button on screen (never mind about
getting them to work...) or to figure out how to create a scroll bar or a
multi-line text entry field with proportional fonts and word wrap! Just
make a VGA full screen PCX drawing of your complete interface, as fancy as
you like, and create a fully working program with Merlin's Application
Framework in minutes!"
Applause as the light dims...
The oversized screen comes to life, showing a car dashboard with slides,
buttons, meters and little blinking lights. The roar of an engine in full
Dolby stereo completes the illusion.
"You can design a custom front end for your annual car model database..."
The presenter uses his laptop to show how to press a button, pop up a menu
and start the application.
The screen fades, and slowly a medieval manuscript comes on the screen,
complete with an illuminated capital on the left. Tinkling harp music can
be heard in the background. On the right, some worn-looking tabs are
visible, and on the bottom you can see the frayed strands of the ribbons
that mark other sections in the book.
"How do you like this as the on-screen catalogue to your antique shop?"
The screen fades again. As it comes back to life, a full featured word
processor is visible, complete with three custom button bars. "This is
just a mock-up, but you can designs applications that look like this..."
As the screen comes back to life for the last time, a misty forest scene
in pale white and green is accompanied by soft New Age music. As the
presenter opens a window, you can see that it is a catalogue of CD's,
hooked to a CD player. The presenter chooses some appropriate music to end
his show. As the lights in the hall come back to life, you think to
yourself "Blast, I didn't know you could do all this with just a simple
16-colour VGA screen! This looks like FUN!"
Meanwhile, the presenter smiles to the applause, and continues to high-
light the many possibilities of this application framework....
Well, it's just a story, but it might as well be true! All that you've
seen you can design with Merlin's Application Framework!
Overview
MakeForm allows you, with absolutely no interface coding at all, to create
a visually stunning graphical front-end (GUI graphical user interface) to
any database or program.
MakeForm can convert a screen drawing (PCX file) that contains buttons,
scroll bars, text entry fields, list box areas and mouse regions into a
real, working program for you. All you need to do is to add the code to
process the user actions, like pressing a button to save something. All
code to handle text input, depressing buttons, using scroll bars etc. is
already present! And that is definitely not to be sneezed at: it includes
proportional font text editing, word wrap, search, copy, paste, formatted
text input, numeric, string, date, memo, logical fields, list boxes,
scroll bars, mouse fields, push buttons, etcetera! Complete code to build
menu bars, drop down menus, pop up menus etc. is included as well. There
are extremely simple calls to put warnings and messages on screen, or
create a pop-up edit box to ask for a file name for example.
Makeform provides an extensive application framework to quickly build
complete graphical applications for DOS, for example database entry forms,
utilities, but also complete 'heavy weight' applications. Examples of what
can be achieved with MakeForm are MakeForm itself, and Merlin's Deluxe
Font Editor, which is part of this package.
MakeForm allows you to write sophisticated programs with just a fraction
of the code you would normally have to write. To back up this claim,
consider the source code of MakeForm itself. If you had to write it
yourself from scratch, you would be expected to write well over 150k of
source code text, not counting all the assembler routines to handle PCX
files etc. However, MakeForm could be re-created using MakeForm itself by
just writing about 700 lines of QuickBASIC code, divided into a MAIN block
and just 5 subroutines!
And all that still results in relatively small EXE files - just consider
the size of MakeForm.EXE (about 90k uncompressed). You can write similar
programs as well, WITH all these nice options and possibilities, and make
C++ programmers turn green with envy!
Application Framework
What is an Application FrameWork? An Application FrameWork is a 'frame-
work' of routines and modules which take care of all the things many
programs have in common. For example text input, pressing buttons, moving
scroll bars, updating the screen, keeping track of the cursor, opening and
closing windows, etcetera. We usually think of the application interface,
so in a sense Windows is an application framework which provides many
services to individual programs, and the dBASE languages (dBASE, Clipper
etc.) are application frameworks as well.
An Application FrameWork has advantages as well as disadvantages. The ad-
vantages are obvious: only a tiny amount of code needs to be written to
complete an application. Most of the 'nitty gritty' stuff is already
present. As long as the capabilities of the Application Framework are what
you need, there are few disadvantages.
The disadvantages are less clear, but nevertheless present. You have to
become familiar with the code, and in effect are learning another (tiny)
programming language. If you want to do things for which the framework
wasn't designed, you may spend a lot of time figuring out how to do that.
It would be less time than it would take to re-write the lot yourself, but
still. Also, many Application Frameworks try to be everything to everyone,
and consequently are so bloated that you end up with executables of 300k
or more just to say 'Hello World'.
How does Merlin's Application Framework tip this balance?
Area of application
Merlin's Application Framework is designed to let you program visually
stunning, graphical, DOS based, full screen applications. It has one edge
over most other programs in this field, and that is that you can design
your screen with a drawing program. So you are NOT limited to 'just'
Windows-type interfaces, which although pretty, are in a sense only text-
type interfaces without any room for artistic input.
To get a good idea of what is possible, visualise the examples from the
story above, or take a good look at the MakeForm MF_TUTOR example, or
Merlin's Deluxe Font Editor. If you want to make programs that look like
that, Merlin's Application Framework is for you!
Artistic aspirations
If you're creative, you like drawing or otherwise creating beautiful
backgrounds, you'll love Merlin's Application Framework. If you don't, you
may invest in a couple of CD-ROM's with PCX files to use. If you want to
program for Windows, you'll hate Merlin's Application Framework - it
wasn't designed to accommodate Windows. You can run any program created by
MakeForm under Windows, provided you do it in a full screen DOS box.
Windows won't let you change colour palettes for starters, and I hate
programs that refuse to let me do things the way I want...
Learning
Merlin's Application Framework is a sophisticated collection of modules
and routines. Although you will only call 3 of these routines yourself,
there will be plenty of opportunities where you can benefit from under-
standing the rest of the framework. The complete QuickBASIC source code
will be yours upon registration. This code is extensively commented, and
if you can't figure out something we are always here, and happy to help
you. In many instances the comments already indicate where customising is
possible. But make no mistake: you will have to spend a little time with
it to become familiar with its workings - comparable to switching from
GWBasic to QuickBASIC for example.
This manual also contains lots of hints and tips that will allow you to
become familiar with the environment very quickly. If you invest in
completing the tutorial (takes about a week of spare time) you will feel
confident in tackling larger projects.
Size
Merlin's Application Framework is small. MakeForm itself can be recompiled
with QuickBASIC alone to about 120k. If you compare that to a Clipper
database browsing utility that easily takes 300k you'll understand that
there is very little overhead in Merlin's Application Framework.
Modules you don't use you can remove, for example scroll bar code can be
removed if your application doesn't use it, or word wrap. To decrease size
even further, MakeForm itself was linked with PDQ, an alternative link-
library from Crescent Software (see credits for their address), reducing
the EXE file to about 90k. 'Diet' did the rest, so the result is an EXE
file of about 48k. Show that to any other programmer, and show them what
MakeForm does, and they start looking for a file called MAKEFORM.OVL of
about 400k! Merlin's Software ... It's Magic!
Bottom line
If you have decided to order MakeForm, based on your evaluation of the
Shareware version, but the product does not live up to your expectations,
please tell us so and we will refund your money. If there are special
things you would like to do, but can't figure out how, feel free to call
on us - we'll be glad to help! We may be able to present a solution very
quickly, and your ideas may very well end up in the next update of the
Application Framework! Sometimes it only takes finding the right spot to
make your changes, sometimes it may be more complicated. And on occasion a
custom module may need to be written. We will gladly give you a quote for
that, no strings attached! This manual also contains instructions for
writing your own custom modules to 'create objects' that MakeForm does not
have.
Language
Merlin's Application Framework was written in QuickBASIC and assembler,
and is meant to be used with QuickBASIC. You do not need to be familiar
with assembler to use Merlin's Application Framework, but you are expected
to be familiar and competent with QuickBASIC. If you use other versions of
BASIC, please get in touch - there may be a version of MakeForm available
for your language. If not, be prepared to spend some time changing
things - for PowerBASIC for example the whole library needs to be rewrit-
ten because string handling is done differently in that language.
MakeForm
The name 'MakeForm' comes from the word 'form', like a tax form, a sheet
with various areas you are supposed to fill in. Databases often use such
'sheets' on screen for the user to fill in, and the obvious application is
a database entry form. Although Merlin's Application Framework can do much
more, the name of the program still reflects its origins. The complete
collection of modules, library, handbook etc. is the actual Application
Framework, the program MakeForm provides the link between the PCX drawing
and the QuickBASIC code that will become the final program you write.
Shareware
My experiences with Shareware are great, except when it comes to people
registering for it ...! So in order to protect my work, the Shareware
version is a complete and fully functioning version, with only one res-
triction: the actual BASIC source code and libraries are missing. You can
test MakeForm, save all your work, test run your interface within MakeForm
itself, and you can also look at the DEMO program source code that Make-
Form creates for you, in order to evaluate how practical it looks to you.
However, due to the missing source code of the other modules, you will not
be able to actually run your application or complete coding it. Also, to
conserve disk space, the Shareware version has a smaller manual, with much
of the detailed information and examples to help you complete your ap-
plication in record time removed.
When you register, you will of course receive the complete source code of
all the modules, the source code of MakeForm itself so you can customise
it if you like, or just see how things were done, plus a registered copy
of Merlin's Deluxe Font Editor so you can design your own custom fonts to
use for text input and display.
Registering is well worth it: sell two or three programs created with
MakeForm and your investment has paid for itself - not to mention you'll
have a lot more fun programming!
Technicalities & legalese
MakeForm requires a VGA screen and a mouse, as will all programs created
by it. Memory requirements are small: 128k will do. A fast VGA card helps
all graphical programs, and Makeform is no exception, and so does a 386
CPU, but the code runs on a 8086 as well.
MakeForm is provided 'as is', without any warranties of any kind. Neither
does Merlin's Software accept any responsibility for any damages resulting
from the use of this program. However, help is of course available - we
like to support you!
The shareware version, without source code or libraries (i.e. without any
files with the extension BAS, LIB or QLB) can be distributed freely.
Programs you write with your registered version of MakeForm can be dis-
tributed without royalties, on the explicit condition that you give credit
to Merlin's Application Framework, in the program itself or the documen-
tation that comes with it.
Credits
I am very much indebted to Crescent Software's Graphics QuickScreen
program in creating MakeForm. Graphics QuickScreen is a fully fledged
drawing program that incorporates the same functionality as MakeForm, and
will also generate DEMO source code. If you're interested in their line of
products, contact them at 32 Seventy Acres, West Redding, CT 06896, USA.
I did a complete and extensive rewrite of the software provided to accom-
modate my own wishes. One of the main improvements is being able to edit
text graphically, with a proportional font of your own choice and crea-
tion, instead of using BASIC's PRINT statement. Other improvements include
reduced code size (yep, in spite of all the improvements!), extensive
mouse support, block marking, search, paste, copy and delete function-
ality, paragraph indentation and word wrap, toggle-state buttons, keyboard
control of scroll bars, hotkey support, mouse cursor bitmaps, list box
item marking and greying, etcetera. So although the functionality is
similar, MakeForm is 100% my own work and in key areas it is a great
improvement!
Other programs that need mentioning are of course Microsoft's QuickBASIC,
various drawing programs and conversion and special effects utilities,
Merlin's Deluxe font Editor and Merlin's Library. Merlin's Application
Framework was designed on an Icon 386/40 with an analogue multisync non-
interlaced monitor and a Tseng ET/4000 based SVGA graphics card.
Quick Start
There are just a few steps to creating a program with MakeForm.
1. Make a .PCX full screen drawing that will be the user front-end. This
contains the buttons, scroll bars, text entry areas, etcetera. More
than one screen can be used, small screens can be designed to handle
sub-tasks, act as pop-up windows or custom button bars, etc. Apart
from the areas for buttons and text input, the screen can be as fancy
as you like.
2. Run MakeForm to define all the fields, and let MakeForm create a
...DEMO.BAS program for you. If you haven't made a drawing yet, and
want to try this program immediately, then load MF_TUTOR to test out
MakeForm (see below).
3. Start up QuickBASIC. You can run the program as it is, and finish the
coding to handle your own specific needs.
If you hate reading manuals (like I do) and want to get a feel for the
program right away, here are some tips:
1. Start MakeForm from the DOS prompt, and read the help file that pops
up. Press Escape to leave that help file, and press Enter to load
MF_TUTOR.
2. Press F5 to Run the form. You can now test a complete example; press
buttons, move scroll bars, enter text, press the Alt-key to check out
the complete menu, etcetera. Press Escape to get out when you get
stuck somewhere. Do not alter any data yet. MakeForm can write a
QuickBASIC source code file for you, that does exactly what you see
here and will be the framework for your application!
3. Press Escape until you are in the Exit warning box, then Enter, to
exit MakeForm again.
PCX files
To create a program interface, first you have to make a PCX full screen
drawing that will be presented to the user. You can make such a drawing
with any drawing program you like, and save it as a PCX file. Use a
graphical conversion program if your drawing program does not support PCX
(unlikely).
Further sub-sections of your intended program might use smaller PCX
screens that pop up over your main screen at any pixel location you like.
In order to convert PCX files successfully, there are a few rules you
should be aware of. Typically the drawing will contain areas for text
input and display, push buttons, scroll bars and mouse regions, and areas
for list boxes or pop-up list boxes and menus. MakeForm supports the
proportional fonts you design with Merlin's Deluxe Font Editor. This
utility is part of this package, and is a good example of what you can
achieve as well. In order to draw your own main screen, first decide on
the font you will use later for text input, and note down its height in
pixels. BASIC's PRINT statement uses a height of 16 pixels on a normal VGA
screen, so this is a fairly common size, and will allow about 30 lines of
text on screen. If you choose a smaller font, you can get more lines on
screen. The width is typically more than 80 characters, because in propor-
tional fonts many letters are narrower than the standard 8 pixels.
With Merlin's Deluxe Font Editor you can design fonts up to 16 by 32
pixels, which is four times the size of the standard characters.
Merlin's Application Framework does not use BASIC's PRINT statement at
all, but instead relies on its own VGAPrint routine to put text on
screen using proportional screen fonts from 6 to 32 pixels in height.
These fonts you can design with Merlin's Deluxe Font Editor, which is
part of this package.
Although there is little point in going into the specifics about drawing
and drawing programs here, a few assorted notes may be of help.
VGA mode: 640 * 480, 16 colours
MakeForm assumes that all PCX drawings are made for 640*480 VGA 16 colour
mode. Any VGA card supports this format. Drawings do NOT have to be full-
screen: you can make smaller drawings that you intend to use as 'pop-up'
forms. MakeForm itself uses a smaller drawing to load as the data entry
screen background. Any drawing can be positioned at any pixel location on
screen.
Palette
Even though only 16 colours are available, your drawing program will let
you adjust any of those 16 colours. Don't like brown? Make it orange! A
custom palette like this gives you far more 'atmosphere' than the default
colour setting can. MakeForm will of course set that palette for you - the
palette information is part of the PCX file that you create. If you
instruct MakeForm to set the palette, you can choose a 'colour fade speed'
to fade out the current colours and fade in the new palette.
If you don't want to set the palette (for example when loading a smaller
PCX file on top of another screen), you can do that too. However... if you
intend to run your program under Windows (other than in a full screen DOS
box), be aware of the fact that Windows will NOT allow you to tamper with
the palette. It would change the colours of everything else on screen too!
So if you are designing for Windows, stick to the default palette and use
colour dithering, however ugly!
Apart from the standard 16 colours, most drawing programs will also let
you use hundreds of dithered 'mixed' colours.
Drawing details
Most fields require only a rectangle in your drawing. Text areas need a
rectangle of at least the height of the font you intend to use. Mouse
areas need a rectangle to define their size, as do menus, list boxes, and
pop-up list boxes. Push buttons and scroll bars are somewhat more spe-
cific. Rather than split the information for all the different field types
over a drawing section, a code section etc., you will find everything that
has to do with scroll bars for example in the scroll bar section. Often
information that has to do with the drawing is related to the code section
anyway.
Snap to Grid
To create text areas, menus and list boxes, you are advised to use the
'Snap to Grid' function that many drawing programs provide, and to set the
height of the grid equal the height of the font you want to use later. You
can use any width, although the 'Snap to Grid' function will make using a
standard alignment very easy.
If you draw a rectangle with the 'Snap to Grid' function, you're
advised to check the exact workings of that function in your drawing
program. Draw a small rectangle on screen, use the Zoom function and
count pixels. A 12-point font needs a height of 12 pixels. A possible
3-D outline around the text area should not overlap this space. The
width can be any value.
MakeForm Overview
This section explains in detail how to use the program MakeForm. MakeForm
converts your PCX drawing into a complete working program, where scroll
bars move, buttons can be depressed, text can be entered, etc. A Quick-
BASIC source code file will be created for you that performs exactly like
the 'test run' you can perform in MakeForm itself. This file you can load
into the QB environment, and complete at your leisure to finish your
application. All code to handle proportional fonts, word wrap, masked text
input, pressing buttons, moving scroll bars, popping up menus etc. is
already present and will be handled transparently for you. All you need to
do is complete the SELECT CASE sections in the MAIN module of the source
code file that MakeForm creates for you, so that when the user presses the
'Exit' button, the program actually exits back to DOS.
MakeForm has four distinct stages of functionality:
1. Design stage
Define field positions and size with the mouse.
Press F1 for general help.
2. Data Entry Screen
Press Enter to define this field's data, help texts, colours etc.
Press F1 for help with any field you need to fill in.
Press the "Close" button to exit this stage.
3. Test run
Press F5 to "test run" your form.
Press Escape to exit this stage.
4. Save
Press F10 to save your work to disk. A DEMO.BAS program will be
created for you. This DEMO will behave exactly as the test run you can
perform in MakeForm. It contains lots of comments that allow you to
complete your program as easily as possible. Save your work often.
There are NO WARNINGS when you quit without saving!
Please note that MakeForm has no 'interface' of its own, like a menu bar
or a status bar. The design stage and the test run stage look quite
similar. In the design stage fields are highlighted with a square of the
size of the field. During the test run you will have a blinking cursor in
the text fields and can enter text etc. If you're not sure what is hap-
pening, press Escape a few times. This will eventually get you to the
final program exit warning. Press Escape again, to stay in MakeForm, and
you are back in the design stage.
Starting MakeForm
You start MakeForm by typing MAKEFORM at the command prompt, and pressing
Enter. MakeForm uses a number of program files, like its own PCX screen,
and needs to be able to find those. So either start MakeForm from its own
directory, or make sure the directory is listed in the PATH statement in
your AutoExec.Bat file. There are no command line options.
If MakeForm cannot start, because you don't have a VGA screen, there is no
mouse, or it can't find its data files, you will be warned and the program
exits back to DOS.
MakeForm first presents you with a small help file. This file is just
another memo-field: you can read it, browse, edit, blockmark, mess it up,
etc. All changes in this help file are written back to disk, so you can
jot down your own notes and hints to remember!
You can call up this help file, and edit it, at any time during the design
stage, by pressing F1.
Creating such a help file edit box in your own program couldn't be
simpler: VGALineInput x0, y0, x1, y1, Edit$ is all it takes! You pass
four pixel corners (the size defines single-line or memo field) and a
string or file contents to edit, and away you go!
Press Escape to exit the help file and continue with the program.
Next, you are presented with a small entry box to enter the name of the
PCX drawing you've made and want to work on. You do not need to type in
the PCX extension. If you do, earlier definitions for this form will NOT
be loaded.
Press Escape to abort the program now, or Enter to continue loading your
drawing.
For a quick test run, load MF_TUTOR, which is a screen that contains
examples of most field types.
Please remember: what you see MakeForm do, you can do too! You have
all the code you need for that! The entry-box just mentioned above for
example is called like this (patterned along LINE INPUT):
VGAQuery Prompt$, Edit$.
Nothing could be simpler now, could it?
Design Stage
The drawing will be loaded next. Please note that PCX files and VGA
640*480 16-colour mode are assumed! PCX files do not need to cover the
complete screen: small drawings which you intend to use as sub-screens can
be loaded too. MakeForm's Data Entry Screen is such an example.
The First Field
If you haven't defined any fields yet during a previous session, press
Insert to Insert a new (first) field. Otherwise you can continue where you
left off.
Select A Field
You can click once to select any field. You can also use the cursor keys
or the tab and shift-tab keys to go from field to field, and you can use
the hotkeys that you have defined for each field to select a field as
well. Fields are highlighted by a dark square, indicating the field size
and position. All fields are accessible at this point, even 'protected'
fields that the user won't be able to access later, and pop-up list box
fields or menu bars that normally can't be accessed by clicking on the
screen area.
Field Size
If you double-click on the current field, the mouse will turn into a full
size crosshair. You can now define the field's position and size. Position
the crosshairs at the top left corner, click and release, and do the same
for the bottom right corner.
If you need to start again, because the top-left corner is marked wrongly,
press the right hand mouse button.
If you don't want to re-position the field, press Escape.
During this stage, you can press 'S' to toggle 'Snap to Grid'. When it
gets toggled on, you have a chance to enter the grid size. Press Escape to
ignore this if you like. Standard Snap uses a grid size of 8 * 16 pixels
which is the default VGA BASIC PRINT character size.
You can move the mouse cursor with the cursor keys as well, for exact
pixel alignment, and press Enter to simulate a mouse click. I find this
much easier than the mouse, or even my own drawing tablet, so I designed
this to work with drawing tablets in absolute mode as well!
Keep working at the field positions, order and size until you are
satisfied. It is easy to insert and delete fields now, before you have
entered a lot of other field data.
Insert / Delete
You can insert and delete fields. Insert will add a field AFTER the
current field. Delete will ask for confirmation. With these two keys, you
can rearrange fields. However, it is better to start in the right order to
begin with. The Delete function is actually only meant to update a form
that you've already made, when you decide later on that some fields were
not necessary after all.
Tab order
Please note that you should define the fields in some sort of logical
order. The order you use now is the order the user gets when he uses the
'Tab' key to go to the next field! Use the Tab key yourself to verify the
order. The same order is used when the user presses Enter in a text field,
to go to the next field. It is good practice not to put buttons or mouse
fields in between the text field tab-order, so the user can fill in all
text fields without losing the cursor in a mouse field, list box or button
in between! This implies as well that it is easier on the user if all text
fields are grouped together on screen.
Think ahead - make your day!
If you want to make coding easy on yourself later, group related fields
together! Make sure all menu bars and drop down menu list boxes are the
first fields, so just one comparison will suffice to exclude all those.
Group buttons together for the same reason. If your form design reflects
such organisation, your users will find it that much easier and more
intuitive to work with, and you'll find that coding your application
becomes a breeze!
If you want to start all over again from scratch, enter the form name
WITH the PCX extension to prevent loading earlier field definitions
upon startup.
Help
Pressing F1 will call up the same help file you've seen at the start of
MakeForm. You can edit this file and insert your own hints and tips -
things which you think you may forget in a month or so! The help file will
be saved to disk automatically. Do NOT enter help for this specific form
or for the intended user - you can do that in the Data Entry Screen!
Data Entry Screen
When a field is highlighted with a rectangle, you can press Enter to go to
the data entry screen for that field. This screen is just another MakeForm
example, and is drawn as a small PCX screen, that is loaded in the centre
of the screen. Here you can fill in all the data for each field. It may
look intimidating at first, but you will usually only fill in four or five
of the entries provided. The rest is handled automatically for you, or is
irrelevant for the field type you are defining. Full details you will find
in the reference section. Concise help is available under F1.
Field Name
The field name you provide is used in creating the DEMO program: in a TYPE
array, and also in a list of CONST declarations, so that you can code
SELECT CASE statements easily. Rather than trying to remember that this
list box is field number 17, you code CASE cFileList: ....
All field names will be prepended with a lower-case "c", which means that
you can use most QuickBASIC reserved words like NAME, OPEN etc. for these
field names! Field names can be 8 characters long.
Using a name like 'INT' would create the CONST cINT, and because CINT
is a reserved BASIC word, QB will point out that you can't use that
when your own DEMO program gets loaded. You can change such errors in
the BI file itself when QB points them out to you - MakeForm will copy
your changes the next time it runs with the same form!
Field Type & default values
Enter the field type. You can select a number from the list on screen. For
more information on the field types, please check out the relevant section
further on in this manual. For now, select the field type that you think
is correct - you can always change it later!
If you set or change the field number, a series of default values will be
loaded in the next fields. So it is quite easy to just set the field
number and press the "Close" button and go on to define the next field.
During the test run you can quickly determine what still needs to be
changed (usually colour schemes).
If you're not sure what a field type does, you can always just set it,
press F10 to save your form, press F5 to run it, and try it out! If
the screen gets messed up, don't worry: MakeForm will load your PCX
file from disk again when you exit the test run with Escape.
Not all field numbers are in use, and beyond 23 you can define your
own custom field numbers. Field type numbers that MakeForm doesn't
know about work like mouse fields (until you code them differently of
course!)
There is one quirk in MakeForm: if you have a block marked in a text
field, the key combination Alt-C is used to 'Copy' that block of text.
So using Alt-C to try and press the 'Close' button will not work. Use
the cursor keys to switch the block off, and then press Alt-C, or use
the mouse to press the Close button.
Advanced note: You could load MakeForm itself into MakeForm (Yes!
Possible!), and re-set flags bit 128 (block is on upon entry) for all
text fields to correct this 'problem'. Or you could define another
hotkey for the 'Close' button, such as F7 or Alt-Q. But: please make
sure you have the original MakeForm.MFM file safe somewhere, just in
case!!
Help
Within each field you can press F1 to get help with what to enter. Each
help text will explain what to enter for all field types that use that
field. If the field type you are defining is a push button, look to the
help text to find out what a push button needs in this field. If the push
button is not mentioned, then skip that entry. If the entry has a meaning-
less value in it, then this is probably a return value from an earlier
test run you have performed on this form. You can safely ignore this, or
re-set it to zero if you like.
You'll quickly remember it anyway, its fairly easy throughout!
Entering Colours
All fields need 4 colours. A text field for example uses normal text
foreground and background colours, as well as block foreground and back-
ground colours. Even though it may feel unfamiliar at first, it is quite
easy to enter four colours in hexadecimal format, like &H5D2E. The leading
"&H" specify hexadecimal notation. After that follow 4 characters, which
can be from 0 to 9, and from A to F. Just pick a colour from the colour
map on your right, and enter the character in the correct position.
To set text field colours, press F1 to get a list of colour meanings. For
text fields, the four colours from left to right are: block background,
text background, block foreground, text foreground. To set the text
colours to bright white on blue, you would enter 1 for blue and F for
bright white in these positions: &H.1.F
Adding black on bright red, which are 0 and C, for the block colours,
would result in the complete colour setting like this: &HC10F.
If you press F1, you'll get a list of all colour meanings for each field
type.
MakeForm will take an intelligent guess at the colours, and will copy the
colours you enter and use those for the next fields of the same type you
define.
Setting Hotkeys
You may wonder how to enter the hotkey value for Alt-H as a hexadecimal
value in the hotkey entry field. Well, don't worry! Pressing F1 for help
when trying to figure out how to enter a Hotkey value in the data entry
form will present you with the option to press the actual hotkey com-
bination you would like to use! If you're defining a 'Help' button for
example, and would like to use Alt-H for that, you press Alt-H now.
MakeForm will enter the correct code for you in the hotkey entry field.
Press Escape to keep the current hotkey setting.
All keys work! So inadvertently pressing cursor down when trying to
enter a hotkey, will enter that key value! You could take advantage of
this to find out other key values.
MakeForm has many more key combinations available than are customary
in QuickBASIC. Ctrl-cursor-up/down, F11, F12, many Alt-cursor com-
binations, etc. Under Alt-Insert for example is a small debug-window,
that will show you the current memory use. I'll leave that in - you
may find it useful during your own program development! Just don't use
it when you're in the big help file.
To find a complete list of key values, including the additions that
MakeForm can generate for you, refer to the library documentation at
the end of this manual (GetKey section).
Help texts
The 'Help text' field, where you would enter the text that the user sees
when he presses F1, has wordwrap turned off. This gives you full control
over the width and layout of your help text. Displaying help texts with F1
is built into the code - you don't have to worry about it at all.
If you do not enter any text, the final program will display "No help for
this field". You can change that text too, of course, in the EditForm
subroutine of the code.
Remember that the help texts are in memory at all times, and take up
QuickBASIC string memory. So short texts are advisable.
Advanced note: If you use a lot of help text, you can write your own
custom code to lift the help texts from disk when asked for. The delay
is not worth bothering about, and it saves memory.
List Box Lists
List boxes use the help text field for the list of items. Items are listed
below each other, one line per item, and they all start with a one-charac-
ter hotkey. Some special characters are used here as well. A full descrip-
tion is available by pressing F1 when you are in the Help field. Please
note that commas are NOT allowed in list box item texts - they have a
special meaning! More information can also be found in the list box
section of this manual.
Close
When you are done, press the 'Close' button to save your entries. Use
Escape to discard your changes or exit quickly if no changes were made.
Make it a habit to press F10 to save your work often!
Warning
NEVER use any of the data fields (that seem to be unused) to enter your
own custom flags or data! All fields are always in use, even if you don't
need to enter data yourself when defining that field!
If apparently unused data fields have numbers in them that you have not
entered, you can ignore them or set them to 0 again - they are return
values from an earlier test run you have performed (maybe in a previous
session).
Test Run
When you are done with defining fields, you can press F5 to 'run' your
form. This will allow you to test-drive all text entry, buttons, scroll
bars, mouse regions etc. and see if they perform the way they should. You
can press buttons, set scroll bars, press mouse fields, enter text in text
fields, etcetera.
You can also test your help function here: whenever you press F1, the help
text for that field should pop up.
Pop-up list boxes are accessed with the TAB key, and with the hotkey
you defined for them - clicking on the area where they are supposed to
pop up is not going to work!
Protected fields, which the user cannot access, are inaccessible to
you too at this stage. Remove the protection flag (Flag field, bit 1)
if you don't want that.
Use Escape to exit this stage. Upon exit, the whole form will be drawn on
screen again from disk. If by mis-aligning fields the screen was messed
up, pressing F5 and then Escape will restore the original drawing.
If a field you remember defining seems to be 'missing', i.e. you can tab
to it but it won't show anything, then chances are that the coordinates
are wrong. Exit the test run, tab to the 'missing' field, press enter, and
enter valid corner pixel coordinates.
Save Your Work
To save your work (you are advised to save your work often, because any
serious software can crash if you try hard enough!) press F10. This will
write all stuff to disk. MakeForm will create four files for you (and
overwrite the old versions!):
FormName.MFM The form you have made, with all field definitions and help
texts. This will be loaded the next time you continue with
this form. To avoid loading it and start from scratch
again, enter the form name WITH the PCX extension.
FormName.BI An include file with the field names, TYPE'd array and list
of CONSTants. Changes you make to this file (to get QB to
load it properly if you've chosen a reserved word for
example) will be copied back by MakeForm again. MakeForm
uses this file to copy the field names only - all other
definitions like integer field, string field etc. are in
the FormName.MFM file.
FormDEMO.BAS Using the first four letters of the PCX file name, and the
DEMO.BAS extension, a QuickBASIC program is made that will
allow you to test drive the form (similar to pressing F5 in
MakeForm). You can copy this file and start coding to com-
plete your program.
FormDEMO.MAK The MAK file that is necessary for a complete program.
In order to run the DEMO program, i.e. your own program, start QB as
follows:
QB /L MakeForm.QLB FormDEMO.BAS
where FormDEMO.BAS is of course the demo file that MakeForm created for
your form. If you loaded a PCX file from a different subdirectory, you
will have to change directory so QB can find the various include files.
Press F5 in QB to run the program.
Please remember that MakeForm will overwrite FormDEMO.BAS
the next time! So once you start coding, rename your MAIN
module to something else! Also use copies of the other
modules, so you can safely make changes without affecting
other programs.
Exit MakeForm
To exit MakeForm, press Escape. You will have a last chance to save your
work by pressing F10, or you can press Enter to ignore that or lose the
changes you've made since you last pressed F10.
Please note that MakeForm gives NO WARNING if you're about to lose
changes, neither in the data entry screen, nor at the end of the
program. So make it a habit to press F10 to save your work!
If you have the shareware or evaluation copy of MakeForm, the .QLB
library and other modules are not present in your copy. You can load
your DEMO.BAS file into QuickBASIC and read through it, to evaluate
how easy it would be to complete your program, but it won't run. To
see your form in a test run, you will have to press F5 from within
MakeForm. Registering is easy and well worth it!
Completing the Program
Completing your program can be very easy or extremely difficult, depending
on what you are trying to do. Further on in the manual there is a tutorial
with a First Project to complete, with lots of hints and tips, that will
get you started as painlessly as possible.
However, to get the general feel of things, you could load the DEMO.BAS
program that MakeForm creates for you into QuickBASIC, open the MAIN
window and read through this chapter with the code in front of you.
The DEMO.BAS program that MakeForm creates for you contains a MAIN module,
with your custom code in it. It also needs a number of modules, which are
listed in the MAK file so that QuickBASIC will load them automatically for
you. These modules handle all text entry, push buttons, scroll bars, list
boxes, hotkey handling etc. for you. Don't look through those just yet...
You will have to start QB as follows:
QB /L MAKEFORM.QLB ....DEMO.BAS
If you have not designed a screen of your own, load MF_TDEMO.BAS. If that
file is not present, let MakeForm create it for you by loading MF_TUTOR
and pressing F10 in MakeForm.
If you have the Shareware version, you can load the DEMO source code into
QB and study it, but you can't run your form from within QB. You CAN run
your form within MakeForm by pressing F5, to test everything.
The MAIN program module looks like this (simplified):
DECLARE's
Housekeeping
DO: GetEvent
EditForm
SELECT CASE .... (three blocks)
LOOP UNTIL ...
Cleanup
Within you main program module, you will find one main LOOP, which is your
form editing loop. Within it are three SELECT CASE statements. Some of
these you will need to complete yourself. There are plenty of comments to
show you what to do, when and why.
The three SELECT CASE sections handle the following events:
1. Completed a press on a button, mouse field, or made a choice in a list
box: you may want to act on this. The user will be surprised if a
button doesn't do anything...
2. Still in the same field: you may want to check on something
3. Going to a new field: you may want to update other fields
A few examples
If you have drawn and defined an "EXIT" button for example, then you would
code within the main SELECT CASE statement a CASE cEXIT. Here you would
code "QuitProgram = true". Now, when you press the EXIT button, the loop
will be exited and the program will tidy up itself and return you to DOS
or the QB environment.
If you have drawn and defined a "SAVE" button or option somewhere, you
would code within the main SELECT CASE statement a CASE cSAVE. Here you
would code "CALL SubSave .....", and create a SUB to handle saving what-
ever you would like to save. Both would be coded in section 1. above.
If you have a scroll bar that supposedly scrolls the text in a memo field,
then under heading 2. above you would check if the scroll bar was moved,
and update the memo field accordingly.
If you have a monetary field, and a tax field, then you may want to update
the tax field by calculating tax from the monetary field, as soon as the
user leaves that field and is done filling in the amount. This would come
under section 3. above.
It looks dead easy, and so it is ... provided your wishes are not too
complicated. But make no mistake: MakeForm is very sophisticated, and you
should expect a reasonable amount of time to become familiar with its
workings. Spend time studying how calls are made, and what they do,
elsewhere in the program, if you want to use any of its abilities your-
self. BUT: you do not NEED to get into the code that is provided. It works
fine, as MakeForm demonstrates, so if you can, limit yourself to coding
your MAIN module and the SELECT CASE statements in it to finish your
program!
The End ....
This is the end of the Shareware MakeForm.Doc file. When you register you
will receive the complete printed manual, almost 100 pages of hints, tips,
documentation, and examples, together with all source code, the library
and everything else you need to create stunning graphical programs in
record time! Please refer to the file REGISTER.DOC!