Solved

Hiding ancestor methods

Posted on 1998-05-26
4
302 Views
Last Modified: 2010-04-06
Is there any way to hide/disable the methods and properties when creating a component based on another component ?
0
Comment
Question by:JustinCase
[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
4 Comments
 
LVL 1

Expert Comment

by:ssite
ID: 1347984
Yeap. If the methods are virtual (can be overriden).

For methods :

Override the method, then just don't call inherited.

For properties

publish the same property (exact name), use both a get and a set function and just don't do anything. (for the get - return something)

Why do you want to do this ?
0
 

Author Comment

by:JustinCase
ID: 1347985
This does not remove the method from the object inspector (I tried it with the OnClick). I should have mentioned that.

I'm creating a specific protocol component from a Serial Com component and do not want public access to a number of methods.

I hope I can avoid cleaning old source.


0
 
LVL 1

Accepted Solution

by:
ssite earned 50 total points
ID: 1347986
OnClick for your knowledge is an EVENT, not a method. To hide onclick (tough) I think you should just inherit from a level which doesn't publish it. Most TCUSTOMXXXX components don't publish anything.

Try it.
0
 
LVL 4

Expert Comment

by:d003303
ID: 1347987
Yo,
there are four privacy levels of an object. Private, protected, public and published. All methods, properties and events can be moved one or more levels into the "visible direction", but not back. Example: You inherit a component from TPanel and it would be possible to hide the owner property. This component would never work because other components on a form need to read this property. To ensure that all objects behave at least like their ancestors (this is polymorphism, e.g. the Sender variable in a TNotifyEvent can carry any TObject descendant, but mostly they are components), this is not allowed.

If you only want to hide published properties or events in object inspector at design time, re-publish them as e.g.
   property Caption : string read FCaption;
and add a private variable
   FCaption : string;
to fool object inspector. The caption property is still read AND writeable (because of polymorphism), but object inspector thinks it is read-only and hides the property at design time.

Have fun,
Slash/d003303
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

617 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