home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource1
/
chint
/
useful17.hnt
< prev
next >
Wrap
Text File
|
1992-06-17
|
1KB
|
35 lines
Here is a modification to the CASHBOOK tutorial to show another way
of initializing a field value. In the running application the user
need to press the <F2> function key when in the field to set/re-set
the value to the default from the look-up file.
1) Copy DBC.SKL to CUSTOM.SKL
2) Modify the "custom_key()" function as follows :--
bool custom_key(int scr, int fno, int *fld, uchar *key)
{
bool tb;
if ((*key == F2) && (fno == 3) && (*fld == 9)) /*ADDED*/
strcpy(CASHBOOK3.DISPDESCR,CASHCODE1.DESCRIPTION); /*ADDED*/
ⁿcodedispⁿ
return(False);
}
3) To the standard CASHBOOK example add one new field to file 3,
call it "DISPDESCR". It should have an edit sequence number of
9 and give it a field picture of "20X", (no default expression
is necessary).
4) Re-generate CASHBOOK but specify the use of CUSTOM.SKL in place
of the standard DBC.SKL on the generate screen.
When entering data into the application at run time simply press the
<F2> function key while in the "DISPDESCR" field and it will take on
the default value.