Solved

How to be notified when a inherited property is changed?

Posted on 1997-08-17
2
325 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi 2 68
How to debug For loops? 3 56
Press three keys together and trigger a function 3 60
Wincontrol not (correctly) drawn 15 40
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

791 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