F
fei_xr
Unregistered / Unconfirmed
GUEST, unregistred user!
{===============================================
问 题:我想设计一个Edit的扩展控件,在控件的属性里
设置与之关联的edit控件,(在输入带计算功能的值时有
用,可以知道当前值由哪些值计算得来)当这个控件获得
焦点里,与之关联的控件颜色发生变化,使控件者知道这
个控件的值与哪些edit有关联,我做好一个关联的,如果需
要关联多个edit应该怎么做?我想不出办法,望前辈们帮忙!!
===============================================}
unit ExEdit;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;
type
TExEdit = class(TEdit)
private
FCEdit : TEdit;
//关联变色edit
proceduredo
Enter;
override;
proceduredo
Exit;
override;
procedure FSetCEdit(AValue: TEdit);
protected
//处理关联控件为空时
procedure Notification(AComponent: TComponent;Operation: TOperation);
override;
published
//设置关联变色的Edit控件,只能设置一个关联控件,
//要关联多个控件时该怎么做?
property Fei_CEdit: TEdit read FCEdit write FSetCEdit;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Fei', [TExEdit]);
end;
{-------------------------------------------
以下为处理关联变色过程
-------------------------------------------}
procedure TExEdit.doExit;
begin
FCEdit.color := clWhite;
end;
procedure TExEdit.doEnter;
begin
FCEdit.color := clRed;
end;
procedure TExEdit.FSetCEdit(AValue: TEdit);
begin
FCEdit := AValue;
if AValue <> nil then
FCEdit.FreeNotification(self);
end;
procedure TExEdit.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if (Operation = opRemove) and (AComponent = Fei_CEdit) then
Fei_CEdit := nil;
end;
end.
问 题:我想设计一个Edit的扩展控件,在控件的属性里
设置与之关联的edit控件,(在输入带计算功能的值时有
用,可以知道当前值由哪些值计算得来)当这个控件获得
焦点里,与之关联的控件颜色发生变化,使控件者知道这
个控件的值与哪些edit有关联,我做好一个关联的,如果需
要关联多个edit应该怎么做?我想不出办法,望前辈们帮忙!!
===============================================}
unit ExEdit;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;
type
TExEdit = class(TEdit)
private
FCEdit : TEdit;
//关联变色edit
proceduredo
Enter;
override;
proceduredo
Exit;
override;
procedure FSetCEdit(AValue: TEdit);
protected
//处理关联控件为空时
procedure Notification(AComponent: TComponent;Operation: TOperation);
override;
published
//设置关联变色的Edit控件,只能设置一个关联控件,
//要关联多个控件时该怎么做?
property Fei_CEdit: TEdit read FCEdit write FSetCEdit;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Fei', [TExEdit]);
end;
{-------------------------------------------
以下为处理关联变色过程
-------------------------------------------}
procedure TExEdit.doExit;
begin
FCEdit.color := clWhite;
end;
procedure TExEdit.doEnter;
begin
FCEdit.color := clRed;
end;
procedure TExEdit.FSetCEdit(AValue: TEdit);
begin
FCEdit := AValue;
if AValue <> nil then
FCEdit.FreeNotification(self);
end;
procedure TExEdit.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if (Operation = opRemove) and (AComponent = Fei_CEdit) then
Fei_CEdit := nil;
end;
end.