Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hiding ancestor methods

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
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 …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

722 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