Solved

How to be notified when a inherited property is changed?

Posted on 1997-08-17
2
332 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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