?? selectbook.cpp
字號(hào):
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "SelectBook.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Parent"
#pragma resource "*.dfm"
TfmSelectBook *fmSelectBook;
//---------------------------------------------------------------------------
__fastcall TfmSelectBook::TfmSelectBook(TComponent* Owner)
: TForm(Owner)
{
m_szBookCode = "";
}
//---------------------------------------------------------------------------
void __fastcall TfmSelectBook::BitBtn1Click(TObject *Sender)
{
Table1->Filter = "";
AnsiString szFilter;
// 設(shè)置條件
if(!Edit1->Text.IsEmpty())
szFilter = "條形碼 = '" + Edit1->Text + "*' and ";
if(!Edit2->Text.IsEmpty())
szFilter = "編號(hào) = '" + Edit2->Text + "*' and ";
if(!Edit3->Text.IsEmpty())
szFilter = "書名 = '" + Edit1->Text + "*' and ";
}
//---------------------------------------------------------------------------
void __fastcall TfmSelectBook::Edit3KeyPress(TObject *Sender, char &Key)
{
if(Key == 13)
BitBtn1->Click() ;
// 將焦點(diǎn)放置到DBGrid,以便選擇
DBGrid1->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TfmSelectBook::DBGrid1KeyPress(TObject *Sender, char &Key)
{
// 回車選擇圖書
if(Key == 13)
{
m_szBookCode = Table1->FieldByName("編號(hào)")->AsString;
this->Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TfmSelectBook::DBGrid1DblClick(TObject *Sender)
{
DBGrid1KeyPress(NULL, 13);
}
//---------------------------------------------------------------------------
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -