home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource1 / chint / useful03.hnt < prev    next >
Encoding:
Text File  |  1992-03-26  |  1.1 KB  |  40 lines

  1. /*
  2.   To allow a database program that is using the standard DataBoss skeleton
  3.   to access a nested menu simply cust the "_Menu" case from the "do_ctl()"
  4.   function in MBRUN.C, and paste it into the "do_ctl()" function in the
  5.   skeleton.
  6. */
  7.  
  8. void do_ctl(mnufrec *m, itmptr itm)
  9. {
  10.     string ts;
  11.     uchar yes[2],tpic[2];
  12.  
  13.     if ((m->curmnu != NULL) && (itm != NULL)) {
  14.         switch (itm->seltyp) {
  15.             case _Proc : do_proc((int) ival(itm->selact),m); break;
  16.             case _Quit :
  17.                 dbgetstr(ts,_Ch,LSC_QuitDataBase,chstr(yes,_YES),chstr(tpic,Pic_U),"",chkyesno,nohelp);
  18.                 quit = (bool)((ts[0] == _YES) && (exitcode != QitKey));
  19.             break;
  20.  
  21. /** Add the following case **/
  22.             case _Menu :
  23.                 if ((ival(itm->selact) > 0) && (m->mat[(int) ival(itm->selact)-1] != NULL)) {
  24.                     if (m->mat[(int) ival(itm->selact)-1]->winp != NULL)
  25.                         jumptomnu(m,(byte) ival(itm->selact));
  26.                     else {
  27.                         m->mat[(int) ival(itm->selact)-1]->pmnu = m->curmnu->mno;
  28.                         m->curmnu = m->mat[(int) ival(itm->selact)-1];
  29.                         dspmnu(m,m->curmnu);
  30.                         m->curitm = m->curmnu->litm;
  31.                         m->level = 0;
  32.                     }
  33.                 }
  34.             break;
  35. /** End Additions **/
  36.  
  37.         }
  38.     }
  39. }
  40.