home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / FRMVIEWS.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-15  |  2.0 KB  |  56 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Frmviews.hpp"
  6. #include "DmCSDemo.hpp"
  7. //---------------------------------------------------------------------------
  8. #pragma resource "*.dfm"
  9. TFrmViewDemo *FrmViewDemo;
  10.  
  11. //---------------------------------------------------------------------------
  12. __fastcall TFrmViewDemo::TFrmViewDemo(TComponent* Owner)
  13.   : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------
  17. // Check to see if there is a format for a try..finally block.
  18. void TFrmViewDemo::ShowTable(char *ATable)
  19. {
  20.    // This is a perfect examples of where a try..finally block is needed
  21.    //  try should be done after the Screen->Cursor = crSQLWait and
  22.    //  then in the finally section, call Screen->Cursor = crDefault.
  23.    //  This would eliminate the two crDefault calls.
  24.    Screen->Cursor = crSQLWait;           // show user something is happening
  25.    try
  26.    {
  27.       VaryingTable->DisableControls();   // hide data changes from user
  28.       VaryingTable->Close();             // close the table
  29.       VaryingTable->TableName = ATable;  // update the table name
  30.       VaryingTable->Open();              // open the table
  31.       VaryingTable->EnableControls();    // show the data changes
  32.       Screen->Cursor = crDefault;        // reset the pointer
  33.    }
  34.    catch(char *E)
  35.    {
  36.       Screen->Cursor = crDefault;
  37.       ShowMessage(E);
  38.    }
  39. }
  40. //---------------------------------------------------------------------------
  41. void __fastcall TFrmViewDemo::FormShow(TObject *Sender)
  42. {
  43.    VaryingTable->Open();
  44. }
  45. //---------------------------------------------------------------------
  46. void __fastcall TFrmViewDemo::BtnShowEmployeeClick(TObject *Sender)
  47. {
  48.    ShowTable("EMPLOYEE");
  49. }
  50. //---------------------------------------------------------------------
  51. void __fastcall TFrmViewDemo::BtnShowPhoneListClick(TObject *Sender)
  52. {
  53.    ShowTable("PHONE_LIST");
  54. }
  55. //---------------------------------------------------------------------
  56.