I wrote :

> A user running my application on a Palm IIIx with OS 3.1 reported an
> unusual bug. I reproduced it under POSE with a OS 3.0 debug ROM. When I
> call:
>
> if ( FrmGetObjectId( form, FrmGetControlGroupSelection( form, ... ) ) ==
> ...)
>
> I get an "Invalid index" error. Decomposing the code, I tried:
>
> UInt16 i = FrmGetControlGroupSelection( form, ... );
>
> and I get 316, for a form that has less than 100 objects. Reading the
> API reference, I see that this API returned a byte instead of a UInt16
> prior to OS 3.5. Trying:
>
> UInt8 byte = FrmGetControlGroupSelection( form, ... );
>
> I get byte = 60, a difference of 256...  Why does the results get
> shifted by 8 bits like this?
>
> Is it possible to write such code that can run properly on both
> pre/post-3.5 OS without explicitly testing for the OS version?

I found a workaround by applying % 256 (modulo 256) to the object index
returned by FrmGetControlGroupSelection so as to compensate for the 8-bit
shift of the Byte value returned under Palm OS 3.1 while the current API
prototype calls for a UInt16. Unless a form grows up to more than 256
objects, this shouldn't be a problem. Is this the usual solution to read
pushbutton selections in pre-OS 3.5?


--
Luc Le Blanc


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to