-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOdabirPrikazaDlg.pas
92 lines (80 loc) · 2.31 KB
/
OdabirPrikazaDlg.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
unit OdabirPrikazaDlg;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, Wwdatsrc, Grids, Wwdbigrd, Wwdbgrid, StdCtrls, dxmdaset;
type
TFOdabirPrikazaDlg = class(TForm)
wwDBGrid1: TwwDBGrid;
wwDataSource1: TwwDataSource;
Button1: TButton;
Tini: TdxMemData;
Tinisection: TStringField;
Tinigrid: TStringField;
Button2: TButton;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
procedure TiniFilterRecord(DataSet: TDataSet; var Accept: Boolean);
procedure wwDBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FOdabirPrikazaDlg: TFOdabirPrikazaDlg;
implementation
Uses BazeModul,PrijaveGrid;
{$R *.DFM}
procedure TFOdabirPrikazaDlg.FormCreate(Sender: TObject);
begin
label1.caption := FPrijaveGRID.Label1.caption;
Tini.Open;
Tini.LoadFromBinaryFile(PathBIN+'PregledGrid.bin');
if tini.RecordCount = 0 then tini.close;
Button1.enabled := tini.active;
end;
procedure TFOdabirPrikazaDlg.Button1Click(Sender: TObject);
begin
ModalResult:=mrOk;
FPrijaveGRID.prikaz := Tini.fieldbyName('section').AsString;
//close;
end;
procedure TFOdabirPrikazaDlg.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Tini.close;
// if ModalResult=mrOk then action := cafree;
end;
procedure TFOdabirPrikazaDlg.Button2Click(Sender: TObject);
begin
ModalResult:=mrOk;
// Close;
end;
procedure TFOdabirPrikazaDlg.TiniFilterRecord(DataSet: TDataSet; var Accept: Boolean);
begin
Accept := DataSet['grid'] = FPrijaveGRID.gridJe;
end;
procedure TFOdabirPrikazaDlg.wwDBGrid1KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
var ime: string;
begin
if key=27 then Close
else if key=VK_Delete then
begin
try
ime:=Tini.FieldByName('section').AsString;
Tini.Edit;
Tini.Delete;
Tini.SaveToBinaryFile(PathBIN+'PregledGrid.bin');
finally
DeleteFile(PathBIN+ime+'.fil');
end;
if Tini.RecordCount = 0 then Tini.Close;
Button1.enabled := tini.active;
end;
end;
end.