-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbokform.cpp
More file actions
64 lines (60 loc) · 2.22 KB
/
bokform.cpp
File metadata and controls
64 lines (60 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "bokform.h"
#include "dmform.h"
#include "treeform.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DBGridEh"
#pragma resource "*.dfm"
TBookForm *BookForm;
//---------------------------------------------------------------------------
__fastcall TBookForm::TBookForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TBookForm::DBGridEh1KeyDown(TObject *Sender, WORD &Key,TShiftState Shift){
if((Key == VK_DELETE)&&!(DM->dsBook->State==dsEdit))
try{
DM->dsBook->Delete();
}
catch(const Exception &E){
Application->MessageBox("Íåâîçìîæíî óäàëèòü êíèãó. Êíèãà èñïîëüçóåòñÿ.", "Îøèáêà", MB_OK);
}
}
//---------------------------------------------------------------------------
void __fastcall TBookForm::BitBtn2Click(TObject *Sender){
MainForm->Tree->Tag=DM->dsBook->FieldByName("KOD")->AsInteger;
ModalResult=mrOk;
BookForm->BitBtn2->Visible=false;
}
//---------------------------------------------------------------------------
void __fastcall TBookForm::BitBtn3Click(TObject *Sender){
DM->dsBook->Edit();
DM->InsertBook();
DM->dsBook->Post();
}
//---------------------------------------------------------------------------
void __fastcall TBookForm::FormClose(TObject *Sender, TCloseAction &Action){
DM->dsBook->Cancel();
BookForm->BitBtn2->Visible=false;
}
//---------------------------------------------------------------------------
void __fastcall TBookForm::FilterEditChange(TObject *Sender){
AnsiString filter,str;
int indx,i=0;
indx=FilterBox->ItemIndex;
str=FilterEdit->Text;
if(indx>0)i=2;
if(str!="")i++;
switch(i){
case 1:filter.printf("F_AUTHOR LIKE '%s%%'",str);break;
case 2:filter.printf("TYPEBOOK=%d",indx);break;
case 3:filter.printf("TYPEBOOK=%d AND F_AUTHOR LIKE '%s%%'",indx,str);break;
default:filter="";
}
DM->dsBook->Filter=filter;
}
//---------------------------------------------------------------------------