I am dequeuing and re-enqueuing pen points, on OS 5.0, from within a program
registered for sysNotifyProcessPenStrokeEvent, so as to capitalize letters
that cross the middle line.  Unfortunately, it just doesn't work on my
hardware device (Clie NX-70), though it seems to work on the simulator for
the device.  I've tried all kinds of combinations in the following code,
such as removing the EvtProcessSoftKeyStroke() call altogether, replacing it
with GrfProcessStroke(), etc., etc.  Some of these work on the simulator,
but none works on my hardware device.

On my hardware device, I either get a hang or else drawing a letter results
in a symbol shift.  What am I doing wrong?  I know that things can be dicey
if I use undocumented routines like EvtEnqueuePenPoint() and
PenScreenToRaw(), but I can't think of any way of not using them.

Here's the relevant snippet of the code registered for
sysNotifyProcessPenStrokeEvent.

            GrfGetNumPoints(&numPts);
            if ( 0 < numPts ) {
                PointType pt;
                PointType start, end;
                Boolean   capitalize;
                Boolean   letter;
                Coord     capLine;
                capLine = Areas[i].bounds.topLeft.x +
Areas[i].bounds.extent.x;
                capitalize = false;
                letter     = false;

                EvtDequeuePenStrokeInfo( &start, &end );  // I tried both
with and without this
                while ( EvtDequeuePenPoint( &pt ), ( pt.x != -1 || pt.y
!= -1 ) ) {
                    if ( pt.x > capLine - TOLERANCE )
                        capitalize = true;
                    if ( pt.x <= capLine + TOLERANCE )
                        letter = true;
                    pt.x *= 2; // compensate for hi-res (needed in sim)
                    pt.y *= 2; // I tried without these two lines on my NX,
and it still doesn't work
                    PenScreenToRaw( &pt );
                    EvtEnqueuePenPoint( &pt );
                }

                pt.x=-1;
                pt.y=-1;
                EvtEnqueuePenPoint( &pt );

                if ( capitalize && letter ) {
                    GrfSetState( 0,nl,1 );
                }

                EvtDequeuePenStrokeInfo( &start, &end );
                EvtProcessSoftKeyStroke( &start, &end );
                break;
              }
          }


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

Reply via email to