Board index » cppbuilder » Unable to add a published __property to my class

Unable to add a published __property to my class


2005-04-07 04:15:28 PM
cppbuilder26
Hi. I've created a new class through
File ->New ->Other ... ->Application.
But I'm unable to add a new __property to the published
section.
class TFrameYearlyItemPage : public TFrameItemPage
{
typedef TFrameItemPage inherited;
__published: // IDE-managed Components
__property bool Var = { read=FVar, write=FVar, default=true };
public: // User declarations
private:
bool FVar;
};
When I compile the above, it errors "Error in module
YearlyItemPage. Incorrect field declaration in class
TFrameYearlyItemPage".
Yet when I move the __property Var to the public section, it
compiles fine.
What am I doing wrong? I'd like to add a published property
to my class.
Thanks.
 
 

Re:Unable to add a published __property to my class

" XXXX@XXXXX.COM " < XXXX@XXXXX.COM >wrote:
Quote

[...] I'm unable to add a new __property to the published
section.
That section is for use by the IDE and the property should go
there only if the class is going to be a component. Put it
under public instead.
~ JD
 

Re:Unable to add a published __property to my class

< XXXX@XXXXX.COM >wrote in message
Quote
__published: // IDE-managed Components
__property bool Var = { read=FVar, write=FVar, default=true };
Pay attention to what the comments in the source code are telling you. That
section is for the *IDE*'s use. Not your's. If you want to expose your own
published properties, creates a second __published section, ie:
class TFrameYearlyItemPage : public TFrameItemPage
{
typedef TFrameItemPage inherited;
__published: // IDE-managed Components
// do not touch the IDE's stuff here
public: // User declarations
private:
bool FVar;
__published:
__property bool Var = { read=FVar, write=FVar, default=true };
};
Gambit
 

{smallsort}

Re:Unable to add a published __property to my class

< XXXX@XXXXX.COM >wrote in message
Quote
But all I see are the properties of class TFrame.
What you describe is what the Object Inspector is supposed to be doing. It
does not display additional published properties that you add to TFrame or
TForm classes.
Gambit
 

Re:Unable to add a published __property to my class

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
What you describe is what the Object Inspector is supposed to
be doing. It does not display additional published properties that
you add to TFrame or TForm classes.
To make the OI recognize the extra properties, try placing the class into a
design-time-only package that calls RegisterCustomModule().
Gambit
 

Re:Unable to add a published __property to my class

"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote
< XXXX@XXXXX.COM >wrote in message
Pay attention to what the comments in the source code are telling you. That
section is for the *IDE*'s use. Not your's. If you want to expose your own
published properties, creates a second __published section, ie:
I tried this and the code now compiles, but the new properties
don't show up in the property list window. That is, I create
a new TForm, and on it put the TFrameItemPage that I created,
but the new properties I added to it don't show up. I was
expecting a property corresponding to Var with name "Var", and
a dropdown with values true or false. But all I see are the
properties of class TFrame.
Thanks.
Quote
class TFrameYearlyItemPage : public TFrameItemPage
{
typedef TFrameItemPage inherited;

__published: // IDE-managed Components
// do not touch the IDE's stuff here
public: // User declarations
private:
bool FVar;
__published:
__property bool Var = { read=FVar, write=FVar, default=true };
};