O
oliver99
Unregistered / Unconfirmed
GUEST, unregistred user!
TEdit里面有一个DBGrid,
为何在属性面板中改DBGrid的属性没用?
下面是一段控件代码,请大家帮帮看看!
unit TextEdit;
interface
uses
SysUtils, Classes, Controls, StdCtrls, DBGrids;
type
TTextEdit = class(TEdit)
private
{ Private declarations }
FDBGrid: TDBGrid;
procedure SetDBGrid(Value: TDBGrid);
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
property DBGrid: TDBGrid read FDBGrid write SetDBGrid;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('VCL', [TTextEdit]);
end;
constructor TTextEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDBGrid := TDBGrid.Create(Self);
FDBGrid.Visible := False;
end;
destructor TTextEdit.Destroy;
begin
if FDBGrid <> nil then
begin
FDBGrid := nil;
FDBGrid.Free;
end;
inherited;
end;
procedure TTextEdit.SetDBGrid(Value: TDBGrid);
begin
FDBGrid.Assign(Value);
//FDBGrid := Value;
end;
end.
为何在属性面板中改DBGrid的属性没用?
下面是一段控件代码,请大家帮帮看看!
unit TextEdit;
interface
uses
SysUtils, Classes, Controls, StdCtrls, DBGrids;
type
TTextEdit = class(TEdit)
private
{ Private declarations }
FDBGrid: TDBGrid;
procedure SetDBGrid(Value: TDBGrid);
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
property DBGrid: TDBGrid read FDBGrid write SetDBGrid;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('VCL', [TTextEdit]);
end;
constructor TTextEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDBGrid := TDBGrid.Create(Self);
FDBGrid.Visible := False;
end;
destructor TTextEdit.Destroy;
begin
if FDBGrid <> nil then
begin
FDBGrid := nil;
FDBGrid.Free;
end;
inherited;
end;
procedure TTextEdit.SetDBGrid(Value: TDBGrid);
begin
FDBGrid.Assign(Value);
//FDBGrid := Value;
end;
end.