Solved

How to be notified when a inherited property is changed?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

14 Experts available now in Live!

Get 1:1 Help Now