home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource1
/
chint
/
useful29.hnt
< prev
next >
Wrap
Text File
|
1993-10-29
|
2KB
|
64 lines
This hint outline how to create a custom skeleton that will allow the
user to jump straight to the entry form they want by pressing the key
"1" .. "9" that corresponds to the number of the entry form they want
to get to. The function outlined below will position at the first
file that uses that entry form.
NB: If there are more than 9 windows then a different way of getting
the window number would need to be devised. I would suggest
using the "choose()" function to give a selection when a particular
function key is pressed.
1) Create a custom skeleton by copying the standard DBC.SKL to a new
file, (EG: COPY DBC.SKL DBCJW.SKL)
2) Now make the following modification to the DBCJW.SKL file, (Note:
JW == Jump to Window).
Locate the function "void do_menu()", and directly before it
insert the following procedure code:--
/*MOD START*/
void goToWindow(int wno)
/* Move to the first file on entry form number "Wno" */
{
int i, locatedFno;
locatedFno = 0;
for (i=maxfilno; i > 0; i--) {
if (winforfile[i] == wno) locatedFno = i;
}
if (locatedFno == 0)
dberrm("That entry form does not appear to be used by any file !");
else {
filno = locatedFno;
switch_file(' ');
}
}
/*MOD END*/
Now go down into the existing code of "void do_menu()" and
locate the line that "case UArr : goud(&dm,Up);" and insert a new
line to catch when the user presses the keys "1" through to "9".
The code will end up looking like this :--
/*MOD*/ case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': goToWindow((byte)(ctlkey)-48); break; /*MOD END*/
case UArr : goud(&dm,Up); break;
case DArr : goud(&dm,Down); break;
3) You can now load DataBoss and then re-generate, (and afterwards
re-compile), your application program, just remember to change
the main skeleton on the GENERATE screen from DBC.SKL to
DBCJW.SKL. When you run the compiled program pressing the keys
1..X, (where "X" is the number of the last entry form), should
jump straight to that entry form.