Solved

Hiding ancestor methods

Posted on 1998-05-26
4
294 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 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

19 Experts available now in Live!

Get 1:1 Help Now