This repository has been archived by the owner on May 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuGrillaGenerica.pas
103 lines (88 loc) · 2.44 KB
/
uGrillaGenerica.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
unit uGrillaGenerica;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uPlantillaGenerica, Data.DB, Vcl.Grids,
Vcl.DBGrids, Vcl.DBCtrls, Vcl.ExtCtrls, Vcl.StdCtrls, System.UITypes;
type
TfrmGrillaGenerica = class(TfrmPlantillaGenerica)
pnl1: TPanel;
pnl2: TPanel;
dsBase: TDataSource;
dbnvgr1: TDBNavigator;
dbgrd1: TDBGrid;
btnNuevo: TButton;
btnEliminar: TButton;
btnExportar: TButton;
btnSalir: TButton;
btnEditar: TButton;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btnSalirClick(Sender: TObject);
procedure dbgrd1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure btnEliminarClick(Sender: TObject);
procedure btnEditarClick(Sender: TObject);
procedure btnNuevoClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmGrillaGenerica: TfrmGrillaGenerica;
implementation
{$R *.dfm}
procedure TfrmGrillaGenerica.btnEditarClick(Sender: TObject);
begin
inherited;
dsBase.DataSet.Edit;
end;
procedure TfrmGrillaGenerica.btnEliminarClick(Sender: TObject);
begin
inherited;
if not (dsBase.DataSet.IsEmpty) then
begin
if MessageDlg('Borrar registro?', mtConfirmation,[mbOK, mbCancel],0) = mrOk then
DSBASE.DataSet.Delete
else
Abort
end
end;
procedure TfrmGrillaGenerica.btnNuevoClick(Sender: TObject);
begin
inherited;
DSBASE.DataSet.Insert;
end;
procedure TfrmGrillaGenerica.btnSalirClick(Sender: TObject);
begin
inherited;
Close;
end;
procedure TfrmGrillaGenerica.dbgrd1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
//var
// grid : TDBGrid;
// row : integer;
begin
// inherited;
// grid := sender as TDBGrid;
// row := grid.DataSource.DataSet.RecNo;
// if Odd(row) then
// grid.Canvas.Brush.Color := clSilver
// else
// grid.Canvas.Brush.Color := clDkGray;
// grid.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
procedure TfrmGrillaGenerica.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
dsBase.DataSet.Close;
end;
procedure TfrmGrillaGenerica.FormShow(Sender: TObject);
begin
inherited;
dsBase.DataSet.Open;
end;
end.