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

Events and TGraphicObject

5 views
Skip to first unread message

David HAROUCHE

unread,
May 8, 2008, 9:19:19 PM5/8/08
to
Yep !

I defined some classes inheriting from TGraphicObject, and I want some new
events handler to appear at the component level !

That is :

TMyObject = class(TGraphicObject)

property OnMyObjectChanged:TNotifyEvent read _onmychange write _onmychange;

end;

TMyClass = class(TPaintBox)

property MyObject:TMyObject read GetMyObject write SetMyObject;

end;

I would like to write something like :

MyClass := TMyClass.Create(Form1);
MyClass.MyObject.OnMyObjectChanged := Form1.DoOnMyChange;

but from the Designer !

DH


Marc Rohloff [TeamB]

unread,
May 9, 2008, 9:28:33 AM5/9/08
to
On Fri, 9 May 2008 03:19:19 +0200, David HAROUCHE wrote:

> MyClass := TMyClass.Create(Form1);
> MyClass.MyObject.OnMyObjectChanged := Form1.DoOnMyChange;
>
> but from the Designer !

As long as all the properties are published this should work already.

--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com

David HAROUCHE

unread,
May 9, 2008, 9:35:22 AM5/9/08
to
Doesn't appear on event's page !

D7 Pers...

DH


Remy Lebeau (TeamB)

unread,
May 9, 2008, 1:01:50 PM5/9/08
to

"David HAROUCHE" <met...@hotmail.com> wrote in message
news:4824...@newsgroups.borland.com...

> Doesn't appear on event's page !

You can't add events to the main component like that.


Gambit


Pieter Zijlstra

unread,
May 9, 2008, 1:16:50 PM5/9/08
to
David HAROUCHE wrote:

> I defined some classes inheriting from TGraphicObject, and I want
> some new events handler to appear at the component level !

That will only work when your TGraphicObject descends from TPersistent.

--
Pieter

Marc Rohloff [TeamB]

unread,
May 9, 2008, 2:09:13 PM5/9/08
to
On Fri, 9 May 2008 19:16:50 +0200, Pieter Zijlstra wrote:

>> I defined some classes inheriting from TGraphicObject, and I want
>> some new events handler to appear at the component level !
>
> That will only work when your TGraphicObject descends from TPersistent.

You could also call 'SetSubComponent(true)' on the sub-component.

Remy Lebeau (TeamB)

unread,
May 9, 2008, 2:20:00 PM5/9/08
to

"Pieter Zijlstra" <p.zylstr...@hccnet.nl> wrote in message
news:xn0fpzhuh...@newsgroups.codegear.com...

Which it does. TGraphicsObject is derived directly from TPersistent.


Gambit


Remy Lebeau (TeamB)

unread,
May 9, 2008, 2:20:49 PM5/9/08
to

"Marc Rohloff [TeamB]" <ma...@nospam.marcrohloff.com> wrote in message
news:1d1qodf6oopop$.dlg@dlg.marcrohloff.com...

> You could also call 'SetSubComponent(true)' on the sub-component.

SetSubComponent() is a TComponent method. TGraphicsObject is not a
TComponent descendant.


Gambit


Marc Rohloff [TeamB]

unread,
May 9, 2008, 4:58:22 PM5/9/08
to
On Fri, 9 May 2008 11:20:49 -0700, Remy Lebeau (TeamB) wrote:

> SetSubComponent() is a TComponent method. TGraphicsObject is not a
> TComponent descendant.

<Confused with TGraphicControl>

Pieter Zijlstra

unread,
May 9, 2008, 5:59:55 PM5/9/08
to
Remy Lebeau (TeamB) wrote:

> > > I defined some classes inheriting from TGraphicObject, and I want
> > > some new events handler to appear at the component level !
> >
> > That will only work when your TGraphicObject descends from
> > TPersistent.
>
> Which it does. TGraphicsObject is derived directly from TPersistent.

I just noted it because in David's version the s in TGraphicsObject was
missing and I thought that what might be the problem is that *his*
TGraphicObject did not descend from TPersistent.

Not that it was a good answer anyway ;)
A descendant of TComponent would be a lot easier to make the events
visible in the OI.

--
Pieter

David HAROUCHE

unread,
May 9, 2008, 6:40:00 PM5/9/08
to
I've done a link between the TPersistent (used as classes for properties and
sub-properties) and the main TControl object by storing the owner and
looping up to the control...

So I can fire a specific control event .... and the events, as it's declared
into the component, do appear into the designer's page !

DH


0 new messages