Board index » delphi » Add extra functionality when value of a published property set in object inspector (Still looking)

Add extra functionality when value of a published property set in object inspector (Still looking)

Hi all,

Still wondering how to add extra functionality when value of a published
property set in object inspector.  Especially when the "write" method
for the property in an ancestor class is private.  Which means if this
"write" and "read" method is overriden by providing your own "write" and
"read" in a child class, the property does not behave as it should.

This is referring to my earlier query:

I have created a custom label from TCustomLabel.  When user set the
property for FocusControl in design time, I want to add some
functionality to the procedure SetFocusControl.  However, this procedure

is private in TCustomLabel and I cannot inherit it.  If I write my own
"read" and "write" for the FocusControl property in my custom component,

it overrides the base class "read" and "write" methods and as a result,
the FocusControl for the label does not work propertly then.  That is
when the
accelerator key for the label is pressed, the cursor or focus does not
move to
the component specified by the label's FocusControl property.

The thing I want to add when the FocusControl of the label is set is for

the label to pass its own reference to the component that it has the
FocusControl on.  This will allow the associated component to "know"
about its associated label so that it can change the appearance, text
etc.. of the label should it want to.

Any more assistance would be greatly appreciated.

Regards,
Lu

 

Re:Add extra functionality when value of a published property set in object inspector (Still looking)


Quote
In article <36EDEED3.F1AA7...@hotmail.com>, Lucian H Eng wrote:
> Still wondering how to add extra functionality when value of a published
> property set in object inspector.  Especially when the "write" method
> for the property in an ancestor class is private.  Which means if this
> "write" and "read" method is overriden by providing your own "write" and
> "read" in a child class, the property does not behave as it should.

In your write method do an

  inherited FocusControl := value;

to pass the buck to the property you replaced.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitely requested!

Re:Add extra functionality when value of a published property set in object inspector (Still looking)


Quote
>   inherited FocusControl := value;

> to pass the buck to the property you replaced.

Thanks Peter.

I thinker around with it yesterday, and found the same solution!
Thanx again all the same.

Regards,
Lu

Other Threads