4 |
BIN MEMO
continued
|
Figure 1.
Structure
of Database Flies Used by BINMEMO.PRG.
Program BINMEMO operates on an arbitrary database file specified at runtime by the user, storing binary disk files into its memo fields or reiiieving them from its memo fieids and writing theni back to disk. SYS.DBF and MEMOLIST.DBF are used by BINMEMO internally. In between runs of the program, MEMOLIST.DBF is stored in a SYS.DBF memo field named ML_DBF.
Next you
tell the
Call for more information!
memo and
write
it
|
to disk. Note that I’ve
included,
just for educational purposes, two different ways to implement the little menu you choose from; one is disarmed with comment asterisks.
I’ve implemented a pop-up menu at the GETwhere you indicate which memo field in the tile you want to use. This popup, displayed by way of an ON KEY LABEL statement,
presents
the user with a list of all the MEMO fields
and only the MEMO fields — in the database s/he opened. Procedures PICKMEMO and PICKMEMO2 build the memo field list in MEMOLIST.DBF, the little database file we keep tucked away in
SYS.DBF.2
The user selects the record s/he wants to work with from a BROWSE window. If s/he needs to add a record into the database s/he can do it from that same BROWSE window by pressing Ctrl-N. If s/he wants to delete unwanted records, Ctrl-T will take care of it. It would, of course, be easy to assign more elegant keys to these operations; I’ve stuck with those native to FoxPro.
I’ve also thrown two other procedures of interest into the soup. Function YesNo displays buttons for the end user at any binary branching point, returning a "Y" or “N” depending on which button the user “pushes”. You pass YesNo() a numeric parameter to define the default anwer.
Procedure ERRMSG allows you to specify a message of arbitrary length, line- by-line in an array. It then displays this message, centered and giving you some control over its placement, using the MODIFY MEMO command with the NOEDIT qualifier so the message can’t be changed. (Come to think of it, the user might enjoy being able to rewrite your error message!)
Whenever we get a user group library I’ll put the routines and other associated files used with BINMEMO.PRG in it. Meanwhile I’ll bring a few copies on disk to the August meeting.
Enjoy!
2 You may note that I am ‘unpacking: MEMOLIST.DBF at the beginning of program BINMEMO, and deleting it only at termination of the program. In a networked application in a situation requiring better security, you could unpack sensitive files only at the moment of actual need, deleting them from the disk immediately after use.
|
4
|
LA. FOX
|
4 |