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
> 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
D7 Pers...
DH
> Doesn't appear on event's page !
You can't add events to the main component like that.
Gambit
> 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
>> 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.
Which it does. TGraphicsObject is derived directly from TPersistent.
Gambit
> You could also call 'SetSubComponent(true)' on the sub-component.
SetSubComponent() is a TComponent method. TGraphicsObject is not a
TComponent descendant.
Gambit
> SetSubComponent() is a TComponent method. TGraphicsObject is not a
> TComponent descendant.
<Confused with TGraphicControl>
> > > 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
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