home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource1
/
chint
/
useful34.hnt
< prev
Wrap
Text File
|
1993-10-21
|
3KB
|
58 lines
This hint supplies a modified version of the standard skeleton where the
changes allow the "Find" facility to change the primary key to what ever
key was last selected in the "Find". Once the primary key has been changed
the "Next", "Prev", "Top", and "Last" functions all determine the record to
position at from the new primary index.
Let's suppose you have a file with indexed fields "ACCOUNT_NUMB" and
"COMPANY_NAME" as key 1 and key 2 respectively. Normally the program
generated by DataBoss will use key 1 for the "Next", "Prev" etc. functions,
so the "Next" record will always be the next one according to the
"ACCOUNT_NUMB" field. With these modifications, however, after you have used
"Find" to find by "COMPANY_NAME" the "Next" record will now be the next
record in order of company name.
The "fileCanWalk" variable is a boolean array (one element or each file). It
is used in the program logic to determine if the primary key can be swapped
for that file. By default fileCanWalk[X], (where "X" stands for the file
number), is only "True" for files that are NOT linked back to a "parent".
I have, however, added code to the "Do_Meu" procedure so that when you hold
down the <Shift> key and press function key "F3", the "FileCanWalk" status
for the current file is swapped.
If "False" (as it will be for any "child" file), it is set to "True", thus
giving access to the new functionallity. If it is "True" then it is set to
"False" and the primary key for that file is automatically swapped back to
key number 1.
There is no harm in removing this bit of code so that users can not change
the "fileCanWalk" status, or changing it to a different "hot key". You could
also modify the default settings of "FileCanWalk" by changing the code of the
"initialize()" procedure, or perhaps more simply adding in code at the end of
"initialize()" to a custom skeleton. Something of the form :--
fileCanWalk[2] = True;
would enable file 2's "walk" ability.
When a "child" file has "fileCanWalk" enable the "Next", "Prev" etc.
functions will not be as fast. This is because every time you locate at a
different record in the child file the program logic must check to see if
there is a different parent record to be aligned, and if there is it must
read it from disk and then update the display.
The skeleton is compressed into USEFUL34.LZH. Use the public domain LHA
compression utility to decompress this file. In case you don't have LHA
a copy of version 2.10 is provided on the hints disk. If you copy LHA210.EXE
to you hard disk then run it LHA 2.10 will unpack itself. You can then use
LHA.EXE to decompress USEFUL34.HNT :--
LHA x USEFUL34.LZH
The skeleton that will be decompressed is called DBCPK.SKL, (DBC Primary Key
skeleton). If you look through the skeleton you will be able to locate all
the relevant modifications as each bit of modified code has the comment
/*MOD PK*/ at the end of each line.