home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opmsam.zip / FORMDEMO.CPP < prev    next >
C/C++ Source or Header  |  1993-06-15  |  16KB  |  535 lines

  1. /*  VCS_ID
  2.  *  $Filename:   formdemo.cpp
  3.  *  $Author  :   John Pompeii
  4.  *  $Revision:   1.1  $
  5.  *  $Date:   28 Dec 1991 14:20:32  $
  6.  */
  7.  
  8. #define InclGraphics
  9. #define InclControls
  10. #define InclForms
  11. #define InclHelp
  12. #include <ObjectPM.hpp>
  13. #include "formdemo.hpp"
  14.  
  15. // Start of the application
  16. short bMainThread :: Start()        
  17. {
  18.     // construct and initialize an instance of the 
  19.     // IPF help manager
  20.  
  21.     wHelpManager help("formdemo.hlp");
  22.     help.SetHelpWindowTitle("Help for FormDemo");
  23.        help.SetHelpTable(MAIN_HELPTABLE);
  24.     help.SetKeysHelpPanel(KEYSHELP);
  25.  
  26.  
  27.     AppWindow w;            // Contstruct the top level frame window
  28.     Exec();                // Go to the message loop.
  29.  
  30.     return 0;
  31. }
  32.  
  33. AppWindow :: AppWindow()
  34. {    
  35.     CreateWindow(FaTitleBar | FaTaskList | FaSysMenu | FaSizeBorder | FaMinMax);
  36.     SetCaption("FormWindow Demo");                      // Set captions
  37.     SetSwitchTitle("FormWindow Demo Program");
  38.     SetIcon(icon = new wIcon(ResIcon, I_FORMDEMO));   // Set the app's icon
  39.  
  40.     // This section create a menu bar and then adds items to the
  41.     // sub menu itself.  It is also possible to construct the menu
  42.     // from the resource file if desired
  43.  
  44.     menubar = new wMenu(this, 100, "~Form\\~Help\\");
  45.     menubar->SetSubMenuItems(SM_HELP, MI_HELP, "~Help for help...;~General help...;~Keys help...;Help ~index;");
  46.     
  47.     // connect to HelpManager object
  48.     AssociateHelp();    
  49.     help = ThisThread->HelpInstance();
  50.  
  51.     np = new FormNoteBook(this, IdNotebook, wPointl(2, 0, DlgUnits),
  52.                          wDimension(296, 150, DlgUnits), WsVisible | BkSpiralBinding);
  53.  
  54.     np->SetMajorTabDimension(wDimension(42, 12, DlgUnits));
  55.     np->SetMinorTabDimension(wDimension(40, 12, DlgUnits));
  56.     wNoteBookPageList *pages = np->Pages();
  57.     data = new FormData;
  58.  
  59.     forms[0]  = new StringForm(pages, data);
  60.     forms[1]  = new CharForm(pages, data);
  61.     forms[2]  = new MLEStringForm(pages, data);
  62.     forms[3]  = new DateForm(pages, data);
  63.     forms[4]  = new TimeForm(pages, data);
  64.     forms[5]  = new ShortForm(pages, data);
  65.     forms[6]  = new LongForm(pages, data);
  66.     forms[7]  = new FloatForm(pages, data);
  67.     forms[8]  = new MoneyForm(pages, data);
  68.     forms[9]  = new ButtonForm(pages, data);
  69.     forms[10] = new ListForm(pages, data);
  70.  
  71.     ChangeFrameSize( CalcFrameSize(wDimension(310, 160, DlgUnits)) );
  72.     ChangePosition(PosCenter);
  73.     np->GotoPage((*pages)[1]);
  74.     Show();
  75.     ToTop();
  76. }
  77.  
  78. AppWindow :: ~AppWindow()
  79. {                   
  80.     delete menubar;
  81.     delete icon;
  82. }
  83.  
  84.  
  85. void AppWindow :: Paint()
  86. {
  87.     WindowPS()->Erase(WindowRectangle(), ClrPaleGray);          // Erase the client window
  88. }
  89.  
  90. // The Close member is called when the "Close" menu option is chosen
  91. // from the system menu.  Returning TRUE from this function allows the
  92. // exit process to continue.  Otherwise, a return of FALSE will prevent
  93. // the application from being closed
  94.  
  95. long AppWindow :: Close(wMessage)
  96. {
  97.     return TRUE;
  98. }
  99.  
  100.  
  101. // Command event to process menu selections
  102.  
  103. long AppWindow :: MenuCommand(wCommandMsg m)
  104. {
  105.     switch(m.usCmd())
  106.     {
  107.         case MI_HELP:
  108.             help->ShowHelp();
  109.             break;
  110.  
  111.         case MI_EXTHELP:
  112.             help->ShowExtendedHelp();
  113.             break;
  114.  
  115.         case MI_KEYHELP:
  116.             help->ShowKeysHelp();
  117.             break;
  118.  
  119.         case MI_INDEX:
  120.             help->ShowIndex();
  121.             break;
  122.  
  123.     }
  124.     return FALSE;
  125. }
  126.  
  127.  
  128. void FormNoteBook :: PageSelected(wNBPageMsg m)
  129. {
  130.     wNoteBookPage *pw;
  131.     static bool fReSelect = FALSE;
  132.     static bool fFirstCall = TRUE;
  133.  
  134.     if (fFirstCall)
  135.     {
  136.         // This event always occurs when the first page is added to
  137.         // a notebook.  Since we want the second page to be at the
  138.         // top, we'll skip this event and set the top page after all
  139.         // pages have been constructed.
  140.  
  141.         fFirstCall = FALSE;
  142.         return;
  143.     }
  144.  
  145.     if (fReSelect)
  146.     {
  147.         fReSelect = FALSE;
  148.         return;
  149.     }
  150.  
  151.     pw = m.CurrentTopPage();
  152.     wFormWindow *pgWin;
  153.  
  154.     // If there is a current top page, dismiss it's form (dialog)
  155.     //
  156.     if (pw)
  157.     {
  158.         if (pw == m.NewTopPage())
  159.             return;
  160.  
  161.         if ((pgWin = (wFormWindow *)pw->GetWindow()) != NULL)
  162.         {
  163.             if (!pgWin->Exit(AcFormExit, NULL))
  164.             {
  165.                 fReSelect = TRUE;    // validation error occured
  166.                 GotoPage(pw);        // re-select current top page
  167.                 return;
  168.             }
  169.             pgWin->Dismiss();
  170.             pw->SetWindow(NULL);
  171.         }
  172.     }
  173.  
  174.     // For a new page, find the form associated with the new page
  175.     // and create its window.
  176.     //
  177.     if ((pw = m.NewTopPage()) != NULL)
  178.     {
  179.         if (pw->GetPageHandle() >= IdMajorSections)
  180.         {
  181.             // major tab was selected in section with minor tab pages
  182.             wNoteBookPageList *pl = Pages();
  183.             pl->Find(pw);
  184.             if (pl->Next())        // select the page after the major tab page
  185.                 GotoPage(pl->Current());
  186.  
  187.             return;
  188.         }
  189.         wFormWindow **forms = ((AppWindow *)ParentWindow())->GetDataForms();
  190.         wFormWindow *fp = forms[pw->GetPageHandle()];
  191.  
  192.         fp->FormUp(this);
  193.         fp->ChangePosition(wPointl(0, 0));
  194.         pw->SetWindow(fp);
  195.         fp->Show();
  196.         (ThisThread->HelpInstance())->SetActiveWindow(fp);
  197.     }
  198. }
  199.  
  200.  
  201. // Data
  202.  
  203. FormData :: FormData()
  204.           : mleString(NULL, 512)
  205. {
  206.     shortUInt = commaUInt = zpadUInt = blankUInt = signedInt =  0;
  207.     ssignedInt = base36UInt = octalUInt = binaryUInt = hexUInt = 0;
  208.  
  209.     ULong = commaULong = zpadULong = blankULong = signedLong =  0;
  210.     ssignedLong = base36ULong = octalULong = binaryULong = hexULong = 0;
  211.  
  212.     dbl = fixedPrec = sdbl = commaDbl = expNot = 0.0;
  213.     *uprString = *lwrString = 0;
  214.     mleString = "This is a multi-line edit control.";
  215.     c = n = u = yn = tf = 0;
  216. }
  217.  
  218. // Forms ...
  219.  
  220. StringForm :: StringForm(wNoteBookPageList *pgList, FormData *data)
  221.             : wFormWindow(D_STRINGS, 5, 0, DlgModeless)
  222. {
  223.     wNoteBookPage *pg;
  224.  
  225.     AddField( new wEditField(FtString, 32, E_STRING, &data->string, NULL) );
  226.     AddField( new wEditField(FtString, 32, E_NBRONLY, &data->numString, "%9") );
  227.     AddField( new wEditField(FtString, 32, E_LETONLY, &data->letString, "%A") );
  228.     AddField( new wEditField(FtCharArray, 32, E_ALLUPPER, data->uprString, "%!") );
  229.     AddField( new wEditField(FtCharArray, 32, E_ALLLOWER, data->lwrString, "%~") );
  230.  
  231.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMajor, ""));
  232.     pg->SetTab("Character");
  233.     pg->SetPageHandle(IdCharTypes);
  234.  
  235.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMinor | BpStatusTextOn, ""));
  236.     pg->SetStatusLine("Characters 1 of 3");
  237.     pg->SetTab("String");
  238.     pg->SetPageHandle(IdStringPage);
  239. }
  240.  
  241. CharForm :: CharForm(wNoteBookPageList *pgList, FormData *data)
  242.             : wFormWindow(D_CHARS, 5, 0, DlgModeless)
  243. {
  244.     wNoteBookPage *pg;
  245.  
  246.     AddField( new wEditField(FtChar, 1, E_CHAR, &data->c, NULL) );
  247.     AddField( new wEditField(FtChar, 1, E_NUMERIC, &data->n, "%9") );
  248.     AddField( new wEditField(FtChar, 1, E_TOUPPER, &data->u, "%!") );
  249.     AddField( new wEditField(FtBool, 1, E_BOOLYN, &data->yn, "%rYN") );
  250.     AddField( new wEditField(FtBool, 1, E_BOOLTF, &data->tf, "%!") );
  251.  
  252.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMinor | BpStatusTextOn, ""));
  253.     pg->SetStatusLine("Characters 2 of 3");
  254.     pg->SetTab("Char");
  255.     pg->SetPageHandle(IdCharPage);
  256. }
  257.  
  258. MLEStringForm :: MLEStringForm(wNoteBookPageList *pgList, FormData *data)
  259.             : wFormWindow(D_MLESTRING, 1, 0, DlgModeless)
  260. {
  261.     wNoteBookPage *pg;
  262.  
  263.     AddField( new wEditField(FtMLString, 256, E_MLESTRING, &data->mleString, NULL) );
  264.  
  265.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMinor | BpStatusTextOn, ""));
  266.     pg->SetStatusLine("Characters 3 of 3");
  267.     pg->SetTab("MLE");
  268.     pg->SetPageHandle(IdMLEStringPage);
  269. }
  270.  
  271.  
  272. DateForm :: DateForm(wNoteBookPageList *pgList, FormData *data)
  273.             : wFormWindow(D_DATES, 5, 0, DlgModeless)
  274. {
  275.     wNoteBookPage *pg;
  276.  
  277.     AddField( new wEditField(FtDate, 10, E_LONGDATE, &data->longDate, "%r/%m/%d/%4y") );
  278.     AddField( new wEditField(FtDate, 8, E_SHORTDATE, &data->shortDate, "%r/%1m/%d/%y") );
  279.     AddField( new wEditField(FtDate, 8, E_NLSDATE, &data->nlsDate, "%c") );
  280.     AddField( new wEditField(FtDate, 24, E_MONTHBYNAME, &data->stringDate, "%B %d, %4y") );
  281.  
  282.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMajor | BpStatusTextOn, ""));
  283.     pg->SetTab("Date");
  284.     pg->SetPageHandle(IdDatePage);
  285. }
  286.  
  287.  
  288. TimeForm :: TimeForm(wNoteBookPageList *pgList, FormData *data)
  289.             : wFormWindow(D_TIME, 5, 0, DlgModeless)
  290. {
  291.     wNoteBookPage *pg;
  292.  
  293.     AddField( new wEditField(FtTime, 8, E_LONGTIME, &data->f24Time, "%H:%M:%S") );
  294.     AddField( new wEditField(FtTime, 11, E_SHORTTIME, &data->f12Time, "%I:%M %p") );
  295.     AddField( new wEditField(FtTime, 11, E_NLSTIME, &data->nlsTime, "%C") );
  296.     AddField( new wEditField(FtTime, 24, E_TIMESTAMP, &data->timestamp, "%r-%R.%4y/%m/%d/%H:%M:%S:%h") );
  297.  
  298.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMajor | BpStatusTextOn, ""));
  299.     pg->SetTab("Time");
  300.     pg->SetPageHandle(IdTimePage);
  301. }
  302.  
  303. ShortForm :: ShortForm(wNoteBookPageList *pgList, FormData *data)
  304.            : wFormWindow(D_INTS, 10, 0, DlgModeless)
  305. {
  306.     wNoteBookPage *pg;
  307.  
  308.     AddField( new wEditField(FtUShort, 5, E_SHORT, &data->shortUInt) );
  309.     AddField( new wEditField(FtUShort, 4, E_ZEROPAD, &data->zpadUInt, "%w4") );
  310.     AddField( new wEditField(FtUShort, 5, E_INITBLANK, &data->blankUInt, NULL, FsInitBlank) );
  311.     AddField( new wEditField(FtShort, 6, E_SIGNED, &data->signedInt) );
  312.     AddField( new wEditField(FtShort, 6, E_SHOWSIGN, &data->ssignedInt, "%+") );
  313.     AddField( new wEditField(FtUShort, 6, E_COMMA, &data->commaUInt, "%,") );
  314.     AddField( new wEditField(FtUShort, 6, E_OCTAL, &data->octalUInt, "%b8") );
  315.     AddField( new wEditField(FtUShort, 16, E_BINARY, &data->binaryUInt, "%b2") );
  316.     AddField( new wEditField(FtUShort, 4, E_HEX, &data->hexUInt, "%b16") );
  317.     AddField( new wEditField(FtUShort, 3, E_BASE36, &data->base36UInt, "%b36") );
  318.  
  319.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMajor, ""));
  320.     pg->SetTab("Integer");
  321.     pg->SetPageHandle(IdIntegers);
  322.  
  323.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMinor | BpStatusTextOn, ""));
  324.     pg->SetTab("Short");
  325.     pg->SetStatusLine("Integers 1 of 2");
  326.     pg->SetPageHandle(IdShortPage);
  327. }
  328.  
  329. LongForm :: LongForm(wNoteBookPageList *pgList, FormData *data)
  330.           : wFormWindow(D_LONGS, 10, 0, DlgModeless)
  331. {
  332.     wNoteBookPage *pg;
  333.  
  334.     AddField( new wEditField(FtULong, 10, E_LONG, &data->ULong) );
  335.     AddField( new wEditField(FtULong, 10, E_ZEROPAD, &data->zpadULong, "%w10") );
  336.     AddField( new wEditField(FtULong, 10, E_INITBLANK, &data->blankULong, NULL, FsInitBlank) );
  337.     AddField( new wEditField(FtLong, 11, E_SIGNED, &data->signedLong) );
  338.     AddField( new wEditField(FtLong, 12, E_SHOWSIGN, &data->ssignedLong, "%+") );
  339.     AddField( new wEditField(FtULong, 13, E_COMMA, &data->commaULong, "%,") );
  340.     AddField( new wEditField(FtULong, 12, E_OCTAL, &data->octalULong, "%b8") );
  341.     AddField( new wEditField(FtULong, 32, E_BINARY, &data->binaryULong, "%b2") );
  342.     AddField( new wEditField(FtULong, 8, E_HEX, &data->hexULong, "%b16") );
  343.     AddField( new wEditField(FtULong, 6, E_BASE36, &data->base36ULong, "%b36") );
  344.  
  345.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMinor | BpStatusTextOn, ""));
  346.     pg->SetTab("Long");
  347.     pg->SetStatusLine("Integers 2 of 2");
  348.     pg->SetPageHandle(IdLongPage);
  349. }
  350.  
  351.  
  352. FloatForm :: FloatForm(wNoteBookPageList *pgList, FormData *data)
  353.           : wFormWindow(D_FLOATS, 5, 0, DlgModeless)
  354. {
  355.     wNoteBookPage *pg;
  356.  
  357.     AddField( new wEditField(FtDouble, 64, E_DOUBLE, &data->dbl, NULL, FsInitBlank) );
  358.     AddField( new wEditField(FtDouble, 64, E_FOURPL, &data->fixedPrec, "%d4%z") );
  359.     AddField( new wEditField(FtDouble, 64, E_SHOWSIGN, &data->sdbl, "%+") );
  360.     AddField( new wEditField(FtDouble, 64, E_COMMASEP, &data->commaDbl, "%,") );
  361.     AddField( new wEditField(FtDouble, 64, E_EXPNOT, &data->expNot, "%e") );
  362.  
  363.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMajor | BpStatusTextOn, ""));
  364.     pg->SetTab("Float");
  365.     pg->SetPageHandle(IdFloatPage);
  366. }
  367.  
  368.  
  369. MoneyForm :: MoneyForm(wNoteBookPageList *pgList, FormData *data)
  370.           : wFormWindow(D_MONEY, 5, 0, DlgModeless)
  371. {
  372.     wNoteBookPage *pg;
  373.  
  374.     AddField( new wEditField(FtMoney, 24, E_AMOUNT, &data->amt, NULL, FsInitBlank) );
  375.     AddField( new wEditField(FtMoney, 24, E_CURRENCYIND, &data->indMoney, "%$") );
  376.     AddField( new wEditField(FtMoney, 24, E_SHOWSIGN, &data->showMoney, "%$%+") );
  377.     AddField( new wEditField(FtMoney, 24, E_COMMASEP, &data->commaMoney, "%$%,") );
  378.     AddField( new wEditField(FtMoney, 24, E_PARENNEG, &data->parenMoney, "%$%(") );
  379.  
  380.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMajor | BpStatusTextOn, ""));
  381.     pg->SetTab("Money");
  382.     pg->SetPageHandle(IdMoneyPage);
  383. }
  384.  
  385. short MoneyForm :: Init()
  386. {
  387.     return 0;
  388. }
  389.  
  390. ButtonForm :: ButtonForm(wNoteBookPageList *pgList, FormData *data)
  391.           : wFormWindow(D_BUTTONS, 6, 0, DlgModeless)
  392. {
  393.     wNoteBookPage *pg;
  394.     wPushButtonField *pf;
  395.  
  396.     AddField( new wRadioButtonField(B_WINDOW, 3, &data->radBtn) );
  397.     AddField( new wCheckBoxField(B_FOUNDATION, &data->foundChk) );
  398.     AddField( new wCheckBoxField(B_GRAPHICS, &data->graphChk) );
  399.     AddField( new wCheckBoxField(B_KITCHEN, &data->ksinkChk) );
  400.  
  401.     AddField( pf = new wPushButtonField( B_UNDO) ); 
  402.     pf->SetFieldClickFn( FORMMETHOD(ButtonForm, ProcUndo) );
  403.  
  404.     AddField( pf = new wPushButtonField( B_MORE) );
  405.     pf->SetFieldClickFn( FORMMETHOD(ButtonForm, DoMore) );
  406.  
  407.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMajor | BpStatusTextOn, ""));
  408.     pg->SetTab("Button");
  409.     pg->SetPageHandle(IdButtonPage);
  410.     SetActionButtons(0, 0, B_HELP);
  411. }
  412.  
  413. short ButtonForm :: ProcUndo(short)
  414. {
  415.     GetField(B_WINDOW)->Update();
  416.     GetField(B_FOUNDATION)->Update();
  417.     GetField(B_GRAPHICS)->Update();
  418.     GetField(B_KITCHEN)->Update();
  419.  
  420.     return 0;    
  421. }
  422.  
  423. short ButtonForm :: DoMore(short)
  424. {
  425.     MoreForm fm(&info);
  426.     fm.FormUp(this);
  427.  
  428.     // reset the help window association
  429.        (ThisThread->HelpInstance())->SetActiveWindow(this);
  430.     return 0;    
  431. }
  432.  
  433. MoreForm :: MoreForm(UserInfo *data)
  434.           : wFormWindow(D_MOREPOPUP, 3, 0, DlgModal)
  435. {
  436.     AddField( new wEditField(FtString, 32, E_NAME, &data->name, NULL, FsRequired) );
  437.     AddField( new wEditField(FtString, 32, E_COMPANY, &data->company) );
  438.     AddField( new wEditField(FtString, 20, E_PHONE, &data->phone) );
  439.     ip = data;
  440.     
  441.     SetOptions(FmEnterExit);
  442.     SetMessageWindow(T_MESSAGES);
  443.     SetActionButtons(DID_CANCEL, DID_OK, DID_HELP);
  444. }
  445.  
  446. short MoreForm :: Init()
  447. {
  448.     if (ip->name.Length() == 0)
  449.         DisplayMessage("Please enter some info about yourself");
  450.  
  451.     SetValError(0);
  452.        (ThisThread->HelpInstance())->SetActiveWindow(this);
  453.     return 0;
  454. }
  455.  
  456. ListForm :: ListForm(wNoteBookPageList *pgList, FormData *)
  457.           : wFormWindow(D_LISTR, 4, 1, DlgModeless)
  458. {
  459.     wNoteBookPage *pg;
  460.     wListRegion *lreg;
  461.  
  462.     AddField( new wEditField(FtLong, 6, E_PARTNO, &partno, NULL, FsRequired) );
  463.     AddField( new wEditField(FtString, 32, E_DESCR, &desc, NULL, FsRequired) );
  464.     AddField( new wEditField(FtMoney, 10, E_AMOUNT, &amt, "%$%,", FsRequired | FsLastRegFld) );
  465.     AddField( new wEditField(FtMoney, 11, E_TOTAL, &total, "%$%,") );
  466.  
  467.     // create the list region and assoicated edit fields with columns
  468.     AddListRegion( lreg = new wListRegion(L_LINEITEMS) );
  469.     lreg->AddGroupObject(E_PARTNO, 40);
  470.     lreg->AddGroupObject(E_DESCR, 112);
  471.     lreg->AddGroupObject(E_AMOUNT, 50);
  472.     lreg->SetProcItemFn(FORMMETHOD(ListForm, ProcItem));
  473.  
  474.     pgList->InsertPage(pg = new wNoteBookPage(NULL, BpMajor | BpStatusTextOn, ""));
  475.     pg->SetTab("List");
  476.     pg->SetPageHandle(IdListPage);
  477.  
  478.     SetMessageWindow(T_MESSAGES);
  479.     SetActionButtons(NULL, NULL, DID_HELP);
  480. }
  481.  
  482. short ListForm :: Init()
  483. {
  484.     wListRegion *lreg = GetListRegion(L_LINEITEMS);
  485.  
  486.     // create some sample line items...
  487.     lreg->InsertItemText("7601!T486 Personal Computer!T$ 1,995.95");
  488.     lreg->InsertItemText("5900!TVGA Color Monitor!T$ 290.00");
  489.     lreg->InsertItemText("1911!T19.2KBaud Fax/Modem!T$ 200.00");
  490.  
  491.     partno = 0;
  492.     amt = 0L;
  493.     desc = "";
  494.     total = 248595L;
  495.     return 0;
  496. }
  497.  
  498. short 
  499. ListForm :: ProcItem(wListRegion *regp, char *itemtext, char **prevdata, short cmd)
  500. {
  501.     char mbuf[12];
  502.     bMoney newVal;
  503.  
  504.     if (cmd != RegDelete)
  505.     {
  506.         regp->ExtractColumnText(itemtext, mbuf, 2);        // get money value
  507.         newVal =mbuf;
  508.     }
  509.     switch (cmd)
  510.     {
  511.         case RegInsert:                                // new item entered?
  512.             regp->SetInsertIndex(LiEnd);
  513.             total += newVal;
  514.             break;
  515.         
  516.         case RegModify:                                // edit existing line item?
  517.         {
  518.                regp->SetInsertIndex(regp->GetCurrentItem());
  519.             bMoney oldVal(prevdata[2]);
  520.             total -= oldVal;
  521.             total += newVal;
  522.             break;
  523.         }
  524.         case RegDelete:
  525.         {
  526.             bMoney oldVal(prevdata[2]);
  527.             total -= oldVal;
  528.         }
  529.     }
  530.     GetField(E_TOTAL)->Update();
  531.     return TRUE;
  532. }
  533.  
  534.  
  535.