Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Publishing Subcomponent Events

149 views
Skip to first unread message

Manan Patel

unread,
May 13, 2003, 1:03:46 PM5/13/03
to
Hi All,

I have a components A(TComponent) and B(TPersistent). B should appear as a
subcomponent of A. I have implemented GetOwner and Assign in B. When I drop
A on a form, the properties of B show up correctly on the properties page in
OI, but the events published in B do not show up on the events page in OI.
What am I missing?

Thanks
Manan


Ehsan Tabari

unread,
May 13, 2003, 2:19:41 PM5/13/03
to
Hi,
It should not be very sophisticated and It must work easily, would you
please give the Assign implementation you wrote and the A class definition ?

Thanks
Ehsan http://www.delphi7.net

"Manan Patel" <n...@spam.please> wrote in message
news:3ec12567$1...@newsgroups.borland.com...

Manan Patel

unread,
May 13, 2003, 1:53:46 PM5/13/03
to
type

TmyEvent = procedure(Sender: TObject; MyValue: Boolean) of object;

TClassA = class;

TclassB = class(TPersistent)
private
FCaption: String;
FMyEvent: TMyEvent;
FOwner: TClassA;
protected
function GetOwner: TPersistent; override;
public
constructor Create(AOwner: TClassA);
procedure Assign(Source: TPersistent); override;
published
property Caption: String read FCaption write FCaption;
property MyEvent: TMyEvent read FMyEvent write FMyEvent;
end;

TClassA = class(TComponent)
private
FClassB: TClassB;
procedure SetClassB(Value: TClassB);
published
property ClassB: TClassB read FClassB write SetClassB;
end;

implementation

function TClassB.GetOwner...
begin
Result := FOwner;
end;

function TClassB.Create...
begin
inherited Create;
FOwner := AOWner;
end;

procedure TClassB.Assign...
begin
if Source is TClass B then
with TClassB(Source) do begin
Self.Caption := Caption;
Self.MyEvent := MyEvent;
end
else
inherited;
end;

// I am creating FClassB in Create of TClassA

procedure TClassA.SetClassB...
begin
FClassB.Assign(Value);
end;

// Caption property appears, MyEvent does not.

Thanks


"Ehsan Tabari" <eh...@tabari-home.de> wrote in message
news:3ec1...@newsgroups.borland.com...

Robert Cerny

unread,
May 14, 2003, 2:54:54 AM5/14/03
to
You're missing the "missing feature" of OI. I did not check, but I think
streaming supports this feature.

--
Robert Cerny
http://codecentral.borland.com/codecentral/ccWeb.exe/author?authorid=18355

"Manan Patel" <n...@spam.please> wrote in message
news:3ec12567$1...@newsgroups.borland.com...

Constantine Yannakopoulos

unread,
May 14, 2003, 9:02:27 AM5/14/03
to
Manan Patel wrote:

What version of Delphi are you using? This is supported since Delphi 6,
not in 5.

Manan Patel

unread,
May 14, 2003, 11:33:24 AM5/14/03
to
D7

Peter Thörnqvist

unread,
May 15, 2003, 4:10:18 PM5/15/03
to
I had a fight with this once and concluded that the default property editor
for TPersistent doesn't handle events, just properties: you need to derive
from TComponent (or above) to get them. I even tried to write a new
TPersistent property editor for events but never managed to make it work.

--
Regards,

Peter Thornqvist
(JVCL Coordinator)
http://jvcl.sourceforge.net


0 new messages