At 12:00am -0700 01-05-18, Palm Developer Forum digest wrote:
>Subject: Invalid char passed to TxtCharAttr?
>From: "John Crouch" <[EMAIL PROTECTED]>
>Date: Thu, 17 May 2001 18:17:14 -0400
>X-Message-Number: 63
>
>When a user is entering text into a text field in our app (gremlins) we get
>this error.  This happens when running on the OS 3.5 debug rom.  I think on
>the physical unit (Symbol 1740 OS 3.5.2) we get a fatal error with less
>description.

This would surprise me. The "invalid character" error is a non-fatal 
alert, so if you get a crash on a release ROM, then something else is 
going wrong.

>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.

Do you have a stack crawl? Without that, it might be difficult to 
figure out what's really happening. The two most likely reasons for 
your problem are:

a. Sign-extension of Char to WChar (already discussed).

b. A virtual character is somehow getting processed as a regular 
character. Normally this means that the command bit in the modifiers 
field of the keyDown event is getting "lost" - either explicitly 
cleared, or a virtual keyDown event gets reposted without the command 
bit set.

>Can someone tell me how to stop this from happening?  We're running an
>English only program, so wide characters are not needed.

The issue isn't wide characters. If a non-virtual character code > 
255 gets passed to a ROM routine on a Latin device, then something 
has gone wrong in either the app code or the OS. Normally character 
attributes are derived by indexing into a table w/the character code. 
Since this table only has 256 entries, you'd get bogus results 
without this check for bad character codes.

-- Ken

Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200

-- 
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