delphi2005调用属性编辑器的问题?帮忙!!!! 在线等!! ( 积分: 50 )

  • 主题发起人 主题发起人 jack2004
  • 开始时间 开始时间
J

jack2004

Unregistered / Unconfirmed
GUEST, unregistred user!
自定义控件中,DataSource和DataField1
unit REdit;

interface

uses
SysUtils, Classes, Controls, StdCtrls, Db, DBCtrls;

type
TREdit = class(TEdit)
private
{ Private declarations }
FAllowChange: Boolean;
FDataLink: TFieldDataLink;
function GetDataField: string;
function GetDataSource: TDataSource;
procedure SetDataField(const Value: string);
procedure SetDataSource(Value: TDataSource);
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(Aowner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
property DataField1: string read GetDataField write SetDataField;
property DataSource: TDataSource read GetDataSource write SetDataSource;
end;

procedure Register;

implementation

//-------------------
uses DesignIntf, DBReg; <-----------提示找不到DBReg
//-------------------

constructor TREdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDataLink:=TFieldDataLink.Create;
FAllowChange:=True;
end;

destructor TREdit.Destroy;
begin
FDataLink.OnDataChange:=nil;
FDataLink.Free;
inherited Destroy;
end;

function TREdit.GetDataField: string;
begin
Result:=FDataLink.FieldName;
end;

function TREdit.GetDataSource: TDataSource;
begin
Result:=FDataLink.DataSource;
end;

procedure TREdit.SetDataField(const Value: string);
begin
FDataLink.FieldName:=Value;
end;

procedure TREdit.SetDataSource(Value: TDataSource);
begin
FDataLink.DataSource:=Value;
end;

procedure Register;
begin
RegisterComponents('Astar', [TREdit]);
//------------------------------------
RegisterPropertyEditor(TypeInfo(string), TREdit, 'DataField1', TDataFieldProperty); <-------不要DBreg,提示找不到TDataFieldProperty
//------------------------------------
end;

end.

Delphi2005下如何解决??????
如果要两个以上的DataField,如何写???
 
自定义控件中,DataSource和DataField1
unit REdit;

interface

uses
SysUtils, Classes, Controls, StdCtrls, Db, DBCtrls;

type
TREdit = class(TEdit)
private
{ Private declarations }
FAllowChange: Boolean;
FDataLink: TFieldDataLink;
function GetDataField: string;
function GetDataSource: TDataSource;
procedure SetDataField(const Value: string);
procedure SetDataSource(Value: TDataSource);
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(Aowner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
property DataField1: string read GetDataField write SetDataField;
property DataSource: TDataSource read GetDataSource write SetDataSource;
end;

procedure Register;

implementation

//-------------------
uses DesignIntf, DBReg; <-----------提示找不到DBReg
//-------------------

constructor TREdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDataLink:=TFieldDataLink.Create;
FAllowChange:=True;
end;

destructor TREdit.Destroy;
begin
FDataLink.OnDataChange:=nil;
FDataLink.Free;
inherited Destroy;
end;

function TREdit.GetDataField: string;
begin
Result:=FDataLink.FieldName;
end;

function TREdit.GetDataSource: TDataSource;
begin
Result:=FDataLink.DataSource;
end;

procedure TREdit.SetDataField(const Value: string);
begin
FDataLink.FieldName:=Value;
end;

procedure TREdit.SetDataSource(Value: TDataSource);
begin
FDataLink.DataSource:=Value;
end;

procedure Register;
begin
RegisterComponents('Astar', [TREdit]);
//------------------------------------
RegisterPropertyEditor(TypeInfo(string), TREdit, 'DataField1', TDataFieldProperty); <-------不要DBreg,提示找不到TDataFieldProperty
//------------------------------------
end;

end.

Delphi2005下如何解决??????
如果要两个以上的DataField,如何写???
 
问题也太不明确了吧
 
Borland/BDS/3.0/source/Win32/db/DBReg.pas
Borland/BDS/3.0/source/Win32/Property Editors/DBReg.pas
 
to zjan521
写了路径也不行啊!!
 
加入环境里试试
 
找到DBReg.pas所在的目录,然后加在BPL的选项的Search Path中
 
设了所有的路径,不管用!!
 
不可能吧。你把路径 ***/Borland/BDS/3.0/source/Win32/db 添加到Win32->Lib Path,不可能不起作用.或者你可以把此文件复制到你自己的工程的目录下边,并且把此文件添加到项目中.至少编译是应该通过的.不过因为实际上DBREG.pas是Delphi当中已经内置的某个bpl的组成部分。因此实际上你应该添加对于相应的bpl的引用。
 
全都设过了,设定***/Borland/BDS/3.0/source/Win32/db 之后又要别的,全部设了之后,要了一个根本不存在的!就没办法了
 
不过因为实际上DBREG.pas是Delphi当中已经内置的某个bpl的组成部分。因此实际上你应该添加对于相应的bpl的引用。
在你的包的require当中添加dcldb90.bpl.
 
加入了dcldb.dcp后成功!!!谢谢zjan521!!!
 
后退
顶部