BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Default property value not working?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Francisco M. Marzoa
Guest





PostPosted: Thu Apr 14, 2005 9:41 am    Post subject: Default property value not working? Reply with quote



Hi there,

I'm trying to write an VCL component to handle serial ports. The
component seems to work fine but the default values assigned to
properties doesnt work :-|

These are the property declarations:

__property DWORD BPS = {
read = GetBPS,
write = SetBPS,
default=115200
};

__property BYTE Parity = {
read = GetParity,
write = SetParity,
default=NOPARITY
};

__property bool Status = {
read = GetStatus,
default=false
};

But when I add an item of this class to a form at desing time, both BPS
and Parity appear with value of "0".

Thanks in advance,

Back to top
Francisco M. Marzoa
Guest





PostPosted: Thu Apr 14, 2005 10:44 am    Post subject: Re: Default property value not working? Reply with quote



I forgot to say that I've also init that properties to that default
values within constructor.

Francisco M. Marzoa wrote:
Quote:
Hi there,

I'm trying to write an VCL component to handle serial ports. The
component seems to work fine but the default values assigned to
properties doesnt work :-|

These are the property declarations:

__property DWORD BPS = {
read = GetBPS,
write = SetBPS,
default=115200
};

__property BYTE Parity = {
read = GetParity,
write = SetParity,
default=NOPARITY
};

__property bool Status = {
read = GetStatus,
default=false
};

But when I add an item of this class to a form at desing time, both BPS
and Parity appear with value of "0".

Thanks in advance,




Back to top
Francisco M. Marzoa
Guest





PostPosted: Thu Apr 14, 2005 2:02 pm    Post subject: Re: Default property value not working? Reply with quote



After some tries and closing and reinstalling the component it seems to
work better ¿?.


Francisco M. Marzoa wrote:
Quote:
I forgot to say that I've also init that properties to that default
values within constructor.

Francisco M. Marzoa wrote:

Hi there,

I'm trying to write an VCL component to handle serial ports. The
component seems to work fine but the default values assigned to
properties doesnt work :-|

These are the property declarations:

__property DWORD BPS = {
read = GetBPS,
write = SetBPS,
default=115200
};

__property BYTE Parity = {
read = GetParity,
write = SetParity,
default=NOPARITY
};

__property bool Status = {
read = GetStatus,
default=false
};

But when I add an item of this class to a form at desing time, both
BPS and Parity appear with value of "0".

Thanks in advance,






Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Apr 14, 2005 6:15 pm    Post subject: Re: Default property value not working? Reply with quote


"Francisco M. Marzoa" <fmmarzoa (AT) softronica (DOT) org> wrote


Quote:
__property DWORD BPS = {
read = GetBPS,
write = SetBPS,
default=115200
};

The DFM and the Object Inspector do not understand DWORD for published
properties. Use 'int' instead.

Quote:
__property BYTE Parity = {
read = GetParity,
write = SetParity,
default=NOPARITY
};

The DFM and the Object Inspector do not understand BYTE for published
properties. Use an enum instead.

Quote:
__property bool Status = {
read = GetStatus,
default=false
};

The DFM won't store that property at all, and the Object Inspector will not
display it either. Streamable, designable properties must be read/writable,
not read-only.

Quote:
But when I add an item of this class to a form at desing time,
both BPS and Parity appear with value of "0".

The component's memory is zeroed out at instantiation. Did you assign the
variable values inside the constructor to be the true default values?


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.