New topic in Macintosh: 

Strange Boolean

georgeml - Tue Jun 10, 2008 2:28 pm

<http://forums.realsoftware.com/viewtopic.php?t=22841>
                                                                                
                                                                                
On PPC builds with RB2008R2 and I believe back to at least 2007R1 the serial 
handshake properties are not proper Booleans. If b is one of these properties 
then (b)<>(b=true) even though RB types it as a Boolean. To illustrate, with 
serial1 Open. This code in a button:
Code:dim b  As Boolean
dim v As Variant
dim ui16 As UInt16
dim s1,s2 As String

v=Serial1.RequestToSend ' you can just use RequestToSend instead of b below but 
this is more interesting
b=v.BooleanValue
ui16=v

if b then
  s1="true"
else
  s1="false"
end if

if b=true then
  s2="true"
else
  s2="false"
end if

MsgBox str(ui16)+ "  "+s1+ "  "+s2


Results in the message:
"4  true  false"  if RequestToSend is true (RTS breakout LED is on)
and 
"0  false  false"  if RequestToSend is false (RTS breakout LED is off)

Other Boolean properties (like xon) I tried result in 1 for true and 0 for 
false. This may help to explain some of the flakey handshake behavior on the 
Mac like LineChangeNotification not working and the handshake states always 
reading false on intel Macs.                                        
                                                                                
                                                                                
                                                                                
                                                                                
                                        



-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

[email protected]

Reply via email to