 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Elizabeth Guest
|
Posted: Mon Apr 04, 2005 1:18 pm Post subject: Hiding properties/methods |
|
|
Hi All,
A derived component displays all the properties in the object inspector of
the parent component which are published .
How to hide the properties/methods of a parent component in the derived
component?.
Thanks,
|
|
| Back to top |
|
 |
Sascha Meijer Guest
|
Posted: Mon Apr 04, 2005 3:21 pm Post subject: Re: Hiding properties/methods |
|
|
Properties which are published are always published.
You can redeclare them in the private or protected section, so acces from
outside the class will be prohibited by the compiler, but you can still see
them in the Object Inspector. It is a Borland issue.
Greetings,
Sascha.
"Elizabeth" <vaab (AT) hcncjk (DOT) com> schreef in bericht
news:42513e7b (AT) newsgroups (DOT) borland.com...
| Quote: | Hi All,
A derived component displays all the properties in the object inspector of
the parent component which are published .
How to hide the properties/methods of a parent component in the derived
component?.
Thanks,
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Apr 04, 2005 6:14 pm Post subject: Re: Hiding properties/methods |
|
|
"Elizabeth" <vaab (AT) hcncjk (DOT) com> wrote
| Quote: | A derived component displays all the properties in the
object inspector of the parent component which are
published. How to hide the properties/methods of a
parent component in the derived component?.
|
Once a property is published, it is always published.
If the class you are deriving from has a TCustom... base class of its own,
it is better to derive from the TCustom... class instead (ie: TCustomEdit
instead of TEdit). The TCustom... classes are designed to not publish their
properties so that you can pick and choose which properties you want to
publish yourself.
If that is not an option, then the only other alternative is to register
NULL property editors for those properties you wish to un-publish. The
properties will still exist, and can be accessed programmably, but the
Object Inspector will not display them.
Gambit
|
|
| Back to top |
|
 |
Todd Brylski Guest
|
Posted: Mon Apr 04, 2005 6:23 pm Post subject: Re: Hiding properties/methods |
|
|
class PACKAGE TNewSpeedButton : public TSpeedButton
{
private:
protected:
public:
__fastcall TNewSpeedButton(TComponent* Owner);
__published:
__property int Margin = { }; //Margin will not appear in Object Inspector
};
But.... you can not prevent the user of your component from accessing the
property at run time. The user code can cast the object to the base class:
((TSpeedButton*)NewSpeedButton1)->Margin = 12345;
That's not good. If the component your are deriving from is one of the
VCL components then derive from one of the TCustom??? classes and
republish the properties that you need.
Todd
"Elizabeth" <vaab (AT) hcncjk (DOT) com> wrote
| Quote: | A derived component displays all the properties in the object inspector of
the parent component which are published .
How to hide the properties/methods of a parent component in the derived
component?.
|
|
|
| Back to top |
|
 |
Elizabeth Guest
|
Posted: Tue Apr 05, 2005 6:43 am Post subject: Re: Hiding properties/methods |
|
|
Hi All,
Thanks for your response.
There is an API UnlistPublishedProperty(Class, PropName) which can be used
to remove the properties from
the object inspector.This is a new feature present in BCB6.Refer the help
file. It requires designintf.hpp and designide.bpi.
However you cannot prevent the access of properties/methods
programmatically.
This still remains an issue for me.
Thanks,
Elizabeth
"Elizabeth" <vaab (AT) hcncjk (DOT) com> wrote
| Quote: | Hi All,
A derived component displays all the properties in the object inspector of
the parent component which are published .
How to hide the properties/methods of a parent component in the derived
component?.
Thanks,
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|