-
Notifications
You must be signed in to change notification settings - Fork 1
/
ModeloListaU.pas
85 lines (72 loc) · 1.96 KB
/
ModeloListaU.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
unit ModeloListaU;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.Grids,
Vcl.DBGrids, Vcl.Buttons, Data.DB;
type
TfrmModeloLista = class(TForm)
gbFiltro: TGroupBox;
gbDados: TGroupBox;
pnControle: TPanel;
editFiltro: TEdit;
lbFiltro: TLabel;
btnFiltro: TBitBtn;
dbgDados: TDBGrid;
btnFechar: TBitBtn;
btnExcluir: TBitBtn;
btnAdicionar: TBitBtn;
btnEditar: TBitBtn;
dsModelo: TDataSource;
//procedure FormClose(Sender: TObject; var Action: TCloseAction);
//procedure FormShow(Sender: TObject);
procedure btnFecharClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmModeloLista: TfrmModeloLista;
implementation
{$R *.dfm}
//encerra o formulário
procedure TfrmModeloLista.btnFecharClick(Sender: TObject);
begin
Close;
end;
//fecha a conexão com a tabela
{
procedure TfrmModeloLista.FormClose(Sender: TObject; var Action: TCloseAction);
begin
dsModelo.DataSet.Close;
Action := caFree;
self := nil;
end;
}
{
procedure TfrmModeloLista.FormShow(Sender: TObject);
begin
//dsModelo.DataSet.Active := true; //uma das maneiras de ativar a tabela
dsModelo.DataSet.Open; //esse método irá ativar e abrir a conexão toda vez que o formulário ficar visível
end;
}
procedure TfrmModeloLista.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmModeloLista.FormCreate(Sender: TObject);
begin
KeyPreview:=true;
end;
procedure TfrmModeloLista.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then begin
SelectNext(ActiveControl as TWinControl,True,True);
key:=#0;
end;
end;
end.