Solved

How to be notified when a inherited property is changed?

Posted on 1997-08-17
2
318 Views
Last Modified: 2010-04-03
I am writing a component which displays a different picture when disabled. How do I know that the enabled property is changed? I can do this by writing "Property Enabled:Boolean read FEnabled write SetEnabled" and do the things I want in the SetEnabled procedure if Enabled is a property declared by me. But this Enabled property is inherited from TCustomControl. I cannot do this in a inherited property. How to tell Delphi to do my code then do the inherited code when the Enabled property is changed?
0
Comment
Question by:sccheung
2 Comments
 

Author Comment

by:sccheung
ID: 1341643
Why don't you answer my question? Not enough points? I increase points to 20. Please answer my question!
0
 
LVL 2

Accepted Solution

by:
icampbe1 earned 20 total points
ID: 1341644
Descend from TCustomControl (or whatever you are using), and declare an Enabled property of your own.  This will 'hide' (not override) the ancestor Enabled.  Create an event like OnEnabledChange in your descendant control.  When the Enabled property is changed, call the Inherited Enabled with that new value and then trigger your own OnEnabledChange event.  That's how you would do it.

I'm assuming you don't want an example for 20 points.

Hope this helps,
Ian C.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now