> I understand that the TxtCharAttr function is being called with a
character
> that is larger than 0xFF (255).  But we don't control any of this code.
This
> happens during text input into a field.
>
> Can someone tell me how to stop this from happening?  We're running an
> English only program, so wide characters are not needed.

TxtCharAttr takes a WChar as a parameter, which is a UInt16. If you try to
pass it a parameter that is a signed char (or Int8), and that parameter has
a value greater than 0x7F, its sign will be extended into the upper byte
when it is converted to a UInt16, thus producing an invalid character code.
One way to prevent this is to select "Use Unsigned Chars" in your C/C++
Language settings panel for your project, as long as this doesn't break
something else in your code. Otherwise, just make sure the character you
pass to TxtCharAttr is an unsigned type. You could probably also use a
typecast within the call itself, e.g. TxtCharAttr((UInt8) myChar).



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

Reply via email to