Board index » cppbuilder » bool value is not saved

bool value is not saved


2004-05-14 02:31:34 AM
cppbuilder112
Hi to all,
I have a bool property declared in this way:
__property bool Myp= {read = FMyp, write = FMyp, stored = true};
i change its value from object inspector but when i run the program it is
not saved. Why? what's wrong??
thanks
Teo
 
 

Re:bool value is not saved

"Gallo_Teo" < XXXX@XXXXX.COM >wrote in message
Quote
i change its value from object inspector but when
i run the program it is not saved. Why? what's wrong??
Are you assigning FMyp an actual value in the constructor at all?
Gambit
 

Re:bool value is not saved

haven't I to do It?
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >ha scritto nel
messaggio news:40a3c433$ XXXX@XXXXX.COM ...
Quote

"Gallo_Teo" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>i change its value from object inspector but when
>i run the program it is not saved. Why? what's wrong??

Are you assigning FMyp an actual value in the constructor at all?


Gambit


 

{smallsort}

Re:bool value is not saved

"Gallo_Teo" < XXXX@XXXXX.COM >wrote in message
Quote
haven't I to do It?
You always have to initialize your default property values in the
constructor. The property declaration don't do it for you.
Gambit
 

Re:bool value is not saved

Remy wrote:
Quote
You always have to initialize your default property values in
the constructor. The property declaration don't do it for you.
...if it's not false, that is. I saw no mention of a default value in
the property declaration, as in {default=true}, so I would not
assume that to be the case. Setting {stored=true} does not
unconditionally cause the property value to be written to the
.dfm, regardless of what it may say in the help file. It is more
likely a device for differently re-declaring a property.
 

Re:bool value is not saved

so, what is the right method to declare a property that is saved when the
project close and that reflect the canching of object inspector?
thanks
Edo
"Fishface" < XXXX@XXXXX.COM ?>ha scritto nel messaggio
Quote
Remy wrote:
>You always have to initialize your default property values in
>the constructor. The property declaration don't do it for you.

...if it's not false, that is. I saw no mention of a default value in
the property declaration, as in {default=true}, so I would not
assume that to be the case. Setting {stored=true} does not
unconditionally cause the property value to be written to the
.dfm, regardless of what it may say in the help file. It is more
likely a device for differently re-declaring a property.


 

Re:bool value is not saved

"Edo" < XXXX@XXXXX.COM >wrote in message
Quote
so, what is the right method to declare a property that is
saved when the project close and that reflect the canching
of object inspector?
The whole purpose of the DFM is to store *non-default* values. If your
constructor initializes the property value to false, then you don't need to
store the value into the DFM unless the value is set to true instead. If
you set "default=false" in the property, and then assign FMyp=false in the
constructor, then the property will be saved in the DFM whenever the Myp
property is assigned to true in the Oject Inspector. That is the way things
are supposed to be used.
Gambit
 

Re:bool value is not saved

Edo wrote:
Quote
so, what is the right method to declare a property that is saved when
the project close and that reflect the canching of object inspector?
You normally would not need to do that.
The streaming system efficiently saves only what it needs to. Since
a boolean property will be initialized to false by the VCL, and that
is the default value, it does not need to write it to the file if it is false.