Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Code Samples & Tips
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.


Using true and false


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-30-2008, 02:53 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 702
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default Using true and false

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.basic4ppc.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
Attached Files
File Type: sbp TrueTest.sbp (2.3 KB, 15 views)
Reply With Quote
  #2 (permalink)  
Old 01-30-2008, 03:48 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,185
Default

You should not declare arrays as booleans.
Just use regular arrays or variables and it should work properly.

Although on certain occasions you can use 0 and 1 as boolean values, it is not supported and you should use true / false constants instead.

The bug described in this link was fixed in V6.05.
Reply With Quote
  #3 (permalink)  
Old 01-30-2008, 04:12 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 702
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Thank you Erel for your explanations.

Klaus
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Making Tab page visibility True/False selectively Wietze Questions & Help Needed 2 10-01-2008 03:46 AM
True colors images and imagebuttons? N1c0_ds Questions & Help Needed 4 09-15-2008 05:57 PM
fullscreen(false) problems kolbe Questions & Help Needed 1 03-22-2008 02:39 AM
True/False values and SQL tables skipper Questions & Help Needed 6 01-18-2008 09:13 AM
True VGA IS POSSIBLE with Basic4Ppc Cableguy Code Samples & Tips 15 11-02-2007 10:46 PM


All times are GMT. The time now is 03:16 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0