If you have written TMyBaseComponent change it to :
 
TMyBaseComponent = class(TComponent)
private
   FMyProp : string;
   FOnMyEvent : TNotifyEvent;
protected
   procedure SetMyProp(Value: string); virtual;
published
   property MyProp : string read FMyProp write SetMyProp;
   property OnMyEvent : TNotifyEvent read FOnMyEvent write FOnMyEvent;
end;

TMyDescendantComponent = class(TMyBaseComponent)
protected
  procedure SetMyProp(Value: string); override;  // Remember to call the inherited method
  ...
end;
 
This allows you to hook any changes to MyProp in TMyDescendantComponent
 
There are several methods to intercept calls to OnMyEvent but I'll leave it to the experts to provide an elegant solution :-)
 
Stephen 

-----Original Message-----
From: Donovan J. Edye [mailto:[EMAIL PROTECTED]]
Sent: Friday, 7 September 2001 11:23 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: [Q] Component Questions

G'Day All,

If I have something like:

TMyBaseComponent = class(TComponent)
private
   FMyProp : string;
   FOnMyEvent : TNotifyEvent;
published
   property MyProp : string read FMyProp write FMyProp;
   property OnMyEvent : TNotifyEvent read FOnMyEvent write FOnMyEvent;
end;

TMyDescendantComponent = class(TMyBaseComponent)


How do you elegantly in the descendant:

1. Determine when MyProp is changed so that TMyDescendantComponent can take some specialised action
2. Determine when OnMyEvent is fired so that TMyDescendantComponent can take some specialised action

TIA

-- Donovan
----------------------------------------------------------------------
Donovan J. Edye [
www.edye.wattle.id.au]
Namadgi Systems [
www.namsys.com.au]
Voice: +61 2 6285-3460
Fax: +61 2 6285-3459
TVisualBasic = Class(None);
Heard just before the 'Big Bang': "...Uh Oh...."
----------------------------------------------------------------------
GXExplorer [
http://www.gxexplorer.org] Freeware Windows Explorer
replacement. Also includes freeware delphi windows explorer components.
----------------------------------------------------------------------

Reply via email to