-
Notifications
You must be signed in to change notification settings - Fork 0
/
ULGenerico.pas
111 lines (99 loc) · 2.9 KB
/
ULGenerico.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
108
109
110
111
unit ULGenerico;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons, PngBitBtn, Grids, DBGrids, FMTBcd, DB,
SqlExpr, Provider, DBClient, WideStrings, DBXFirebird, Registry, IdCoder,
IdCoder3to4, IdCoderMIME, IdBaseComponent;
type
TfrmLGenerico = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
status: TPanel;
GroupBox1: TGroupBox;
btConsultar: TPngBitBtn;
btEditar: TPngBitBtn;
GroupBox2: TGroupBox;
grdDados: TDBGrid;
dsTab: TDataSource;
cdsTab: TClientDataSet;
dspTab: TDataSetProvider;
sqlTab: TSQLQuery;
Panel3: TPanel;
lblRegistro: TLabel;
procedure Consultar;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure grdDadosTitleClick(Column: TColumn);
procedure btConsultarClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
sql, Usuario : String;
end;
Const
BancoChave : String = '\Software\Microsoft\Windows\CurrentVersion\Explorer\ITAC\Banco';
var
frmLGenerico: TfrmLGenerico;
Reg : TRegistry;
implementation
uses UFuncoes, UDados, UPrincipal;
{$R *.dfm}
procedure TfrmLGenerico.btConsultarClick(Sender: TObject);
begin
Consultar;
end;
procedure TfrmLGenerico.Consultar;
begin
//Processo para efetuar consulta padrão
cdsTab.Close;
sqlTab.Close;
sqlTab.SQL.Clear;
sqlTab.SQL.Add(sql);
cdsTab.Open;
if cdsTab.Eof then begin
lblRegistro.Caption := 'Registro(s) Listado(s): 0';
end else begin
lblRegistro.Caption := 'Registro(s) Listado(s): ' + IntToStr(cdsTab.RecordCount);
end;
end;
procedure TfrmLGenerico.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Release;
end;
procedure TfrmLGenerico.FormCreate(Sender: TObject);
begin
status.Caption := frmPrincipal.sistema;
end;
procedure TfrmLGenerico.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then begin
Key := #0;
Perform(WM_NEXTDLGCTL, 0, 0)
end;
end;
procedure TfrmLGenerico.grdDadosTitleClick(Column: TColumn);
var
i : integer;
begin
for I := 0 to grdDados.Columns.Count - 1 do begin
if (grdDados.Columns[i].Title.Font.Style = [fsBold]) then begin
grdDados.Columns[i].Title.Font.Color := clBlack;
grdDados.Columns[i].Title.Font.Style := [];
end;
end;
cdsTab.IndexFieldNames := Column.FieldName;
Column.Title.Font.Style := [fsBold];
for I := 0 to grdDados.Columns.Count - 1 do begin
if (grdDados.Columns[i].Title.Font.Style = [fsBold]) then begin
grdDados.Columns[i].Title.Font.Color := clBlue;
grdDados.Columns[i].Title.Font.Style := [fsBold];
end else begin
grdDados.Columns[i].Title.Font.Color := clBlack;
grdDados.Columns[i].Title.Font.Style := [];
end;
end;
end;
end.