This template is the main driver for the SMALLSYS template
system. Based on what's in the editor at generation time,
it will generate system code that may incorporate Pop-up
menus, scrolling pick-list windows, edit, append and search
windows, pop-up confirmation boxes (e.g. for deletions),
and pop-up help.
There's no single shape to the system SMALLSYS generates: it
depends on the boxes present at generation time, and the
way you've linked them together.
Hold on...what's a link? A is link just a few words you
you put in a box slot, or an option action, to tell SMALLSYS
that something should be done at that point in the system.
First, let's backtrack a little. To SMALLSYS, each box in the
editor represents some piece of the system. A Menu box (a
box with Option boxes inside it) represents a menu, surprisingly
enough. A box with fields in it might represent an Edit or
Append operation; a box with the text 'Delete: are you sure?'
and a logical memvar in it might be for confirming a delete.
Links specify how these boxes are used: if you wanted a menu
option to bring up an edit window on the current record within
a database, you'd put a link in the action for that option.
Okay -- so what exactly does 'put a link in' mean? What's the
syntax, what means what, what's legal? 2 answers:
1. the rest of this doc tells you in detail
2. the example design in USER.WW is a full-featured
example. Load it, look around, and generate using
SMALLSYS.TEM. You'll see what the whole thing is
supposed to do for you. Go do that now. And remember,
when you face that huge jumble of boxes that
USER.WW contains, to use the Depth-O-Scope (from F3:Edit)
to make your like easier. I couldn't have done the
example without it, and for it I thank me.
If you're reading this, you've either generated with USER.WW
or you're the kind of person who reads everything first.
Since most of our customer's don't, I'll assume you've
done the example, and [linked and] run the resulting code.
So, here we go with the specs:
In USER.WW (for example), the top node of the system is a
menu. It contains 3 option boxes, each of which has a link
defined in its option action. The link specifies what the
option should do. Here's what one of those links looks like:
What this means is, "When this option is selected, I want
the system to pop up a Picklist based on the box ULNAME.
By the way, generate the picklist code as a procedure."
(We'll go into detail in a minute, but basically the Picklist
could be a procedure or a module, and specifying it in the
link avoids SMALLSYS asking you which you want.)
Because of this link, SMALLSYS will generate code to call the
picklist for when that option is selected, and it'll also
generate the picklist procedure itself.
Here's another example: In the box ULNAME (the box we
specified in the above option to do a Picklist with)
in USER.WW, there are a few links defined in ULNAME's
slots. One of them looks like this:
Help key 28 box ULISTHELP code PROC
This means: "From this box, pop up the box ULISTHELP as help
whenever inkey value 28 (the F1 key) is hit. Generate the
code as a procedure."
Now, before we go any further, here's the exact syntax of links,
and where and how you specify them.
1. In option boxes, links are specified as part of the option's
action. An option may have at most one link. The link is
surrounded by << and >> to distinguish it from literal
option action code, which may also be given in the option's
action, and, as usual, is written directly into the generated
code. AN OPTION LINK DOESN'T NEED TO SPECIFY A KEY. This
is because an option gets selected based on a specific key
anyway (the option's trigger) -- there's no need to define it
twice. In fact, any key specification in an option link is
2. In any other boxes, links are given in the box's slots.
They may appear in any slot, and there may be any number of
them. Within one slot you may put several links if you
separate them with semicolons (;). In box slots, the
links are NOT surrounded by << and >>.
3. Links have 4 clauses. One is mandatory, the other three
are optional. They are:
[key ] [box ] [code ]
is the action to take,
is the inkey() value of the key that
provokes the action,
is the name of the box that the act uses
as its object, and
is the type of code to generate.
If any but the parts of a link are unspecified, SMALLSYS
will ask you for them at generation time. (Except for the 'key'
clause in an option's link, which is unnecessary as noted above.)
As you may think, and each have a particular
set of legal values, and the sets vary, depending on the
situation you're in. Let's take each clause individually.
Here's the complete set of action words that Smallsys recognizes.
Two other aspects of a link depend on what the link
The first is the -- for most s, the
allowable code types are MODULE and PROC -- module and procedure.
For a few, the link may alternately specify the INLINE code type.
(Allowable types for each link action are specified below.)
The second thing that depends on the action word is whether any
further links are collected from the box specified as the link's
object. For instance, when SMALLSYS sees this link:
Menu key 13 box USTMEN
it will look in the box USTMEN for any links defined there, and
add them to the pile of system links. This is because, obviously,
a Menu within a system will almost certainly provoke further
action. On the other hand, when SMALLSYS sees
Help key 28 box URECHELP
it won't look for any more links, since a Help box doesn't
call anything else. Whether any further links will be collected
from within a link object is also noted below, for each link
- just display the box specified in the link.
The Display box may be any box you can draw in UI --
however, only display code for the box's literal text is
generated. Any fields, memvars, etc, within the
box are ignored.
Allowable code types for Display links are INLINE, MODULE
No further links are collected from a Display box.
- Pop the box specified in the link, wait for a key
to be pressed, pop the box down.
As with Display, the Help box may be any box, but only display
code for the literal text will be generated.
Note that there is no particular significance attached to
the word 'Help' -- it simply means 'popup, pause, popdown'.
A Help link could just as well be used as a signon, or warning,
Allowable code types for Help links are MODULE and PROC.
INLINE may also be used ONLY IF THE LINK IS SPECIFIED FROM
A PICKLIST (see below) -- the reason for this is that, within
a Picklist, SMALLSYS will trigger the help from within
the Picklist code itself, and so in-line code is possible.
From any other code, help is done using SET KEY (in Clipper)
or ON KEY, and so a procedure or module must be called.
No further links are collected from a Help box.
- Pop the box specified in the link, @..GET the logical
variable contained in the box, then pop the box down,
passing back the logical value input.
A Confirm box must contain 1 logical memvar. SMALLSYS will
generate display code for the box text, and @..GET code for
the first logical memvar it finds within the box; any other
memvars (or fields) in the box are ignored. If no logical
memvar is present, SMALLSYS will report an error.
Allowable code types for Confirm are INLINE, MODULE and PROC.
No further links are collected from a Confirm box.
- Delete is synonymous with Confirm. The same action is
generated and the same box rules apply.
Allowable code types for Delete are INLINE, MODULE and PROC.
No further links will be collected from a Delete box.
Example: in USER.WW, the link:
Delete key -3 box UDEL code PROC
appears in two places: once in the box UREC, used by several
parts of the system for Editing and Appending, and once
in an option within the box USTMEN, an 'add/edit/delete/search'
kinda menu. UDEL is the delete box.
- Pop the specified box and its options; take whatever action
is specified within an option box when one is selected.
Unpop the menu box and return when either an option is
selected or escape is hit, passing back a logical
value representing whether an option was ever selected.
NOTE that the Menu action TERMINATES AFTER 1 OPTION SELECTION.
The Loopmenu action (below) repeats until Escape is pressed,
or an option is selected that has the link <> specified.
<> is a special link that only has meaning within
a Loopmenu box.
The box specified in a Menu link must contain at least one
option box within it. Any fields or memvars within the menu
box are ignored. If the box designated in a menu link has no
options, SMALLSYS will error.
Further links are a little trickier with menu boxes. No
further links are collected from the Menu box itself,
however further links ARE collected from the Menu box's
options, as might be assumed.
The legal links within a menu's option boxes are: <>,
<>, <>, <