-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUOsadzeni.pas
108 lines (89 loc) · 2.21 KB
/
UOsadzeni.pas
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
unit UOsadzeni;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, db, FileUtil, ZDataset, rxdbgrid, Forms, Controls,
Graphics, Dialogs, ExtCtrls, Buttons, StdCtrls, rxdbutils, datamodule;
type
{ TOsadzeni }
TOsadzeni = class(TForm)
btnOK: TBitBtn;
btnAnuluj: TBitBtn;
DSOs: TDataSource;
edWyszukaj: TEdit;
Label1: TLabel;
Panel1: TPanel;
Panel2: TPanel;
RxDBGrid1: TRxDBGrid;
ZQOs: TZQuery;
procedure btnOKClick(Sender: TObject);
procedure btnAnulujClick(Sender: TObject);
procedure edWyszukajChange(Sender: TObject);
procedure edWyszukajKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure edWyszukajKeyPress(Sender: TObject; var Key: char);
procedure FormCreate(Sender: TObject);
procedure RxDBGrid1DblClick(Sender: TObject);
private
public
FIdo: integer;
end;
var
Osadzeni: TOsadzeni;
implementation
uses LCLType;
{$R *.frm}
{ TOsadzeni }
procedure TOsadzeni.edWyszukajChange(Sender: TObject);
begin
with ZQOs do
begin
Close;
ParamByName('nazwisko').AsString:= Trim( edWyszukaj.Text +'%');
Open;
end;
end;
procedure TOsadzeni.edWyszukajKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
case Key of
VK_RETURN: begin
Key:= VK_UNKNOWN;
btnOK.Click;
end;
VK_DOWN: begin
ZQOs.Next;
Key:= VK_UNKNOWN;
end;
VK_UP: begin
ZQOs.Prior;
Key:= VK_UNKNOWN;
end;
end;
end;
procedure TOsadzeni.edWyszukajKeyPress(Sender: TObject; var Key: char);
begin
case Ord(Key) of
VK_SPACE: Key:= #0;
VK_ESCAPE: begin
edWyszukaj.Text:='';
edWyszukaj.SetFocus;
end;
end;
end;
procedure TOsadzeni.FormCreate(Sender: TObject);
begin
edWyszukajChange(Sender);
end;
procedure TOsadzeni.RxDBGrid1DblClick(Sender: TObject);
begin
btnOK.Click;
end;
procedure TOsadzeni.btnOKClick(Sender: TObject);
begin
if IsDataSetEmpty(ZQOs) then FIdo:=0
else FIdo:= ZQOs.FieldByName('ido').AsInteger;
end;
procedure TOsadzeni.btnAnulujClick(Sender: TObject);
begin
FIdo:=0;
end;
end.