-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOdabirUnit.pas
84 lines (72 loc) · 1.96 KB
/
OdabirUnit.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
unit OdabirUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
dxCntner, dxTL, dxDBCtrl, dxDBGrid, ExtCtrls, Db, DBTables;
type
TOdabir = class(TForm)
Panel1: TPanel;
dxDBGrid1: TdxDBGrid;
qOdabir: TQuery;
dsOdabir: TDataSource;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure dxDBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure dxDBGrid1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Odabir: TOdabir;
implementation
Uses Main, PojamUnit;
{$R *.DFM}
procedure TOdabir.FormShow(Sender: TObject);
begin
qOdabir.Open;
dxDBGrid1.CreateDefaultColumns(dxDBGrid1.DataSource.DataSet,dxDBGrid1);
try
dxDBGrid1.ColumnByFieldName('Sifra_sorte').Visible:=False;
except
end;
try
dxDBGrid1.ColumnByFieldName('Sifra_partnera').Visible:=False;
except
end;
end;
procedure TOdabir.FormClose(Sender: TObject; var Action: TCloseAction);
begin
try
SifSorta:=qOdabir.FieldByName('Sifra_sorte').AsInteger;
except
SifSorta:=0;
end;
try
SifPartner:=qOdabir.FieldByName('Sifra_partnera').AsInteger;
except
SifPartner:=0;
end;
qOdabir.Close;
dxDBGrid1.DestroyColumns;
end;
procedure TOdabir.dxDBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=27 then Close
else if key=13 then Close;
end;
procedure TOdabir.dxDBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if Key in ['A'..'Z','a'..'z','0'..'9','š','ð','è','æ','ž','Š','Ð','Ž','Æ','È'] then
begin
PojamForm.Edit1.Text := Key;
PojamForm.Edit1.SelStart := 1;
PojamForm.ShowModal;
if PojamForm.ModRes then
qOdabir.Locate(dxDBGrid1.FocusedField.FieldName,PojamForm.Edit1.Text,[loCaseInsensitive, loPartialKey]);
end;
end;
end.