frmviews.cpp
来自「《C Builder 5程序设计——数据库应用实务篇》程序源代码」· C++ 代码 · 共 56 行
CPP
56 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Frmviews.h"
#include "DmCSDemo.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TFrmViewDemo *FrmViewDemo;
//---------------------------------------------------------------------------
__fastcall TFrmViewDemo::TFrmViewDemo(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------
// Check to see if there is a format for a try..finally block.
void TFrmViewDemo::ShowTable(char *ATable)
{
// This is a perfect examples of where a try..finally block is needed
// try should be done after the Screen->Cursor = crSQLWait and
// then in the finally section, call Screen->Cursor = crDefault.
// This would eliminate the two crDefault calls.
Screen->Cursor = crSQLWait; // show user something is happening
try
{
VaryingTable->DisableControls(); // hide data changes from user
VaryingTable->Close(); // close the table
VaryingTable->TableName = ATable; // update the table name
VaryingTable->Open(); // open the table
VaryingTable->EnableControls(); // show the data changes
Screen->Cursor = crDefault; // reset the pointer
}
catch(char *E)
{
Screen->Cursor = crDefault;
ShowMessage(E);
}
}
//---------------------------------------------------------------------------
void __fastcall TFrmViewDemo::FormShow(TObject *Sender)
{
VaryingTable->Open();
}
//---------------------------------------------------------------------
void __fastcall TFrmViewDemo::BtnShowEmployeeClick(TObject *Sender)
{
ShowTable("EMPLOYEE");
}
//---------------------------------------------------------------------
void __fastcall TFrmViewDemo::BtnShowPhoneListClick(TObject *Sender)
{
ShowTable("PHONE_LIST");
}
//---------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?