Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hiding ancestor methods

Posted on 1998-05-26
4
Medium Priority
?
305 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
  • 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 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

783 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