-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathXDBGrid.pas
More file actions
70 lines (55 loc) · 1.36 KB
/
Copy pathXDBGrid.pas
File metadata and controls
70 lines (55 loc) · 1.36 KB
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
unit XDBGrid;
interface
uses
{ System }
System.SysUtils, System.Classes,
{ Vcl }
Vcl.Controls, Vcl.Grids, Vcl.DBGrids;
type
TCellClickEvent = procedure (Column: TColumn) of object;
TXDBGrid = class(TDBGrid)
private
{ Private declarations }
FColumnClick: Boolean;
FColumn: TColumn;
FOnCellDblClick: TCellClickEvent;
protected
{ Protected declarations }
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer); override;
procedure DblClick; override;
procedure CellClick(Column: TColumn); override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
property OnCellDblClick: TCellClickEvent read FOnCellDblClick write FOnCellDblClick;
end;
implementation
{ TXDBGrid }
procedure TXDBGrid.CellClick(Column: TColumn);
begin
inherited;
FColumn := Column;
FColumnClick := False;
end;
constructor TXDBGrid.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FColumnClick := False;
end;
procedure TXDBGrid.DblClick;
begin
if FColumnClick then
inherited
else
if Assigned(FOnCellDblClick) then
FOnCellDblClick(FColumn);
FColumnClick := False;
end;
procedure TXDBGrid.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
FColumnClick := True;
end;
end.