home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource1 / chint / useful01.hnt < prev    next >
Encoding:
Text File  |  1992-06-22  |  1.7 KB  |  49 lines

  1. /*
  2.   These modifications have been designed specifically  with the DataBoss
  3.   CASHBOOK example in mind.  Copy DBP.SKL to CASH.SKL and make the following
  4.   modifications to "Custom_Key".  Re-generate CASHBOOK specifying CASH.SKL
  5.   to observe the results when <F2> is pressed when editing the cheque
  6.   details, (AMOUNT or LEDGER CODE fields).
  7.  
  8.   a) How to use Custom_Key to pop up a "Choose" box to select a field value.
  9.  
  10.   b) How to use Custom_Key to pop up a "List" to select a field value and
  11.      then fill in default values for other fields from the listed file.
  12. */
  13.  
  14. bool custom_key(int scr, int fno, int *fld, uchar *key)
  15. /*
  16.   We save and restore the value of "*fld" because functions like "list()",
  17.   "choose()" and "found()" can modify its value, which would change the field
  18.   we would edit next.
  19.  
  20.   Before we call "displayrec()" to update the screen we disable the "tabular"
  21.   nature of file 3 because a full table display could possibly get different
  22.   data into the record buffers.
  23. */
  24. {
  25.     bool tb;
  26.   uchar dummy[81];
  27.   int savFld, savTab;
  28.  
  29.   savFld = *fld;                         /* Save the current value of *fld */
  30.  
  31. /*a*/
  32. /**/  if ((*key == F2) && (fno == 3) && (*fld == 5))
  33. /**/    choose(dummy,"   123.00|   234.00","Rent|Car Lease",CASHBOOK3.AMOUNT);
  34.  
  35. /*b*/
  36. /**/if ((*key == F2) && (fno == 3) && (*fld == 7)) {
  37. /**/  list(dummy,7,1,CASHBOOK3.LEDGER_CODE);
  38. /**/  pad(CASHBOOK3.REASON,CASHCODE1.DESCRIPTION,30,Right);
  39. /**/  savTab = tabsize[3];  tabsize[3] = 1;   /* Disable "tabular" in edit */
  40. /**/  displayrec(3,2);
  41. /**/  tabsize[3] = savTab;                            /* Restore "tabular" */
  42. /**/}
  43.  
  44.   *fld = savFld;                          /* Restore the old value of *fld */
  45.  
  46.     ⁿcodedispⁿ
  47.     return(False);
  48. }
  49.