Solved

How to be notified when a inherited property is changed?

Posted on 1997-08-17
2
334 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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