Using true and false

klaus

Expert
Licensed User
Longtime User
I submit my experience (problem I had) with true and false.
In my programs I use an Init file where I save setup settings and in particular CheckBox settings. This file is automatically saved at App_Close.
To do that I used variables to store the CheckBox.Checked setting.
These variables were saved in the Init file.
The problem I had was on the device.

The first time I used the program on the device, without having changed the values in the CheckBoxes these variables had the value of 0.

After reading the file and setting
CheckBox1.Checked=0 works in the IDE does not work on the device

After checking and unchecking the CheckBox the variables become
false which is OK.
Before finding this I tried to use boolean variables declared as
Dim CheckBox1_2(1) as boolean

After reading the file
CheckBox1.Checked=CheckBox1_2(0) works on the device but not in the IDE
Erel, is this the same as in post?
http://www.b4x.com/forum/showthread.php?t=1604&highlight=true+false

I solved the problem in not using variables any more and saving directly the Checked parameter
FileWrite(c1,CheckBox1.Checked)
and the same in reading
CheckBox1.Checked=FileRead(c1)

I added a small program that shows the different behaviours.

Hope this could avoid some trouble to others.

Klaus
Switzerland
 

Attachments

  • TrueTest.sbp
    2.3 KB · Views: 279
Top