Contents of the MENUBAR.DOC file
*============================> MENUBAR.DOC <===========================*
Copyright 1987 Brian W. Gardner,
Centra, Inc. 5156 Sinclair Road, Columbus,Ohio 43229
Phone: 614-846-5200 (voice)
Menubar is a procedure you may call from dBASE III Plus or Quicksilver that
produces pull-down menus with an inverse video highlight (Lotus 1-2-3 style).
The user can either move the lightbar with the cursor keys, or select the first
letter of any listed choice (provided that they are unique) to branch program
execution, or select a range of choices. It reduces the coding necessary for
"menu" screens to a minimum, and provides a "tiled window look" to your
Since it is written in dBASE III Plus, and not in assembly language (I will
work on that later), it is somewhat slow on 8088 computers, and/or in
interpreted dBASE. I usually compile with Quicksilver to make it lightning
fast. I have not tested this with Clipper or FoxBase+, but I expect that it
will work fine with both. Please notify me of any problems or incompatibil-
ities you find. I will do what I can.
*=========================> HOW TO USE MENUBAR <=======================*
You can keep Menubar.prg as a separate file, or include it in a procedure
file. Call it like this:
DO MENUBAR WITH 'menutitle','boxtype',trow,tcol,menuwidth,'mclear'
MENUTITLE is a character string that contains all of your menu choices.
Delimit each choice with an UNDERSCORE character, and be sure to put an
underscore at the end of the string.
BOXTYPE allows you to select what kind of box to draw around the menu
choices. Current the standard single or double boxes are used. If you want
to get fancy, change the code to include color borders, invisible boxes, etc.
This is also a character variable which must be enclosed in either single or
double quotes. The choices that Menubar accepts are 'sgl' and 'dbl' (lowercase).
TROW is the number of the row you want the top of the box to be in. You must
specify a valid row number, or dBASE will bomb out. Be sure to take into
account how many rows the box will take up (the number of your menu choices
TCOL is the number of the column you want the left side of the box to be in.
Be sure to leave enough room for the box to fit on the screen.
MENUWIDTH is the width of the box. Each of the choices is centered in this
area, so leave enough room for your widest choice plus a little space on either
side. The next release of this program will probably offer the option of left
justification, right justification, or centered text in the window. If you
work in dBASE, you should be able to do it yourself with ease, if you don't
like centered labels.
MCLEAR is a true-false variable (EXPRESSED AS A CHARACTER VARIABLE!) that flags
the routine to either clear the window after a selection has been made, or to
leave it on-screen. This allows you to tile windows so that the user can see
all the branches of his/her choice.
DO Menubar WITH 'Add Titles_Edit Titles_Print Reports_Quit_',;
If the user presses an arrow or direction key, the light bar will move in the
direction indicated. If the arrrow is at the top and the user presses the
up-arrow, the bar will go around to the bottom. Home and PgUp place the
light bar at the top; End and PgDn place it at the bottom.
If the user presses , the program will assume the last choice
you give (usually Quit, or Return to Main Menu). That way you can nest
these little fellows without worrying about falling through to dBASE. This will
probably mess up your ON ESCAPE if you use it, so either comment those lines
out, (you can find them by the comments), or SET ESCAPE OFF.
If the user presses the first letter of a choice, the program will assume the
first choice in MENUTITLE that begins with that letter. If you intend to use
this, please try to make your choices all begin with different letters (an
occaisionally challenging task).
Whatever the user chooses is returned to the calling program by the memory
variable MCHOICE. MCHOICE is a character variable representing the number of
the choice in MENUTITLE. In our example above, selecting Print Reports would
mchoice = '3'
If you declare the variable (privately) from the calling program. be sure to
comment out the line in Menubar that contains -
or you will get a whopping error message at runtime (Quicksilver).
Be sure to see the sample program I included to learn more about how to use
If you have any questions, problems, or want to chat, leave a message for
me either at the Darwin BBS 301-251-9206 or at the Colossus in Columbus,
Ohio at 614-889-9829. If for any reason I get thrown off those boards, I will
attempt to leave a trail of breadcrumbs. In any event, you can leave a message
on Compuserve ID.#71530,153.
I am releasing this to the Public Domain since I doubt that anyone will or
should want to pay even a trifle for it. Use it in good health. I would ask
a couple of favors of those who use it:
1. If you can improve upon this code (and I think you can), share it
with me. We will both be the richer for it.
2. Leave my name and address on the source code, unless it is really
essential that you remove it.
3. Don't charge anyone for it if you include it in a professionally
sold custom application. I didn't charge you.
Please share good programming with others. Unless you a really giving some
incredible trade secret away, and those are rare, you have everything to gain.