[VCXMD] Discovery: Field_GetFlag - Make Sure You Coerce Strings to Numbers

Ken Ray kray at sonsothunder.com
Fri Mar 21 22:59:43 CST 2003


Here's a discovery I made using the VXCMD under MC on OS 10.2.4: get a
BORef and a FldRef and then do this:

on mouseUp
  put "1,2,4,8,16,32" into tFlags
  put "" into tFlagVals
  repeat with x = 1 to the number of items of tFlags
    put Valentina("Field_GetFlag",fldRef,(item x of tFlags)) into line x
of tFlagVals
  end repeat
  put tFlagVals
end mouseUp

and you get TRUE for every flag, regardless if it's set or not. The
reason is that the "item x of tFlags" is retrieving the number as a
STRING and not as a NUMBER, so Valentina is treating it as such. To make
sure you coerce it 
to a number, add 0 to the result, so "item x of tFlags" becomes "(item x
of tFlags)+0".

Just FYI,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 



More information about the Valentina mailing list