 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Francisco M. Marzoa Guest
|
Posted: Thu Apr 14, 2005 9:41 am Post subject: Default property value not working? |
|
|
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
|
Posted: Thu Apr 14, 2005 10:44 am Post subject: Re: Default property value not working? |
|
|
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
|
Posted: Thu Apr 14, 2005 2:02 pm Post subject: Re: Default property value not working? |
|
|
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
|
Posted: Thu Apr 14, 2005 6:15 pm Post subject: Re: Default property value not working? |
|
|
"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 |
|
 |
|
|
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
|
|