On Fri, Sep 22, 2000 at 01:02:10PM -0400, Marcelo Gorini wrote:
> 
>       I would like to enter just upper case letters in my fields, so I'm
> trying to set the CapsLock automatically for the graffiti but without
> success. How could I do that? I already tried to use the GrfSetState,
> GsiSetShiftState...  How can I create programmatically the two strokes (Caps
> Lock)?
>       CW 6,  Palm OS 3.5
> 
> Thanks!
> 
> Marcelo 
> 
> snip code:
>               case frmOpenEvent:
>                       frmP = FrmGetActiveForm();
>                                               
>               //      GrfSetState(true, true,true);
>                       
>                       
>                       InfoFormInit( frmP);
>                       FrmDrawForm ( frmP);
>                       GrfInitState();
>                       GrfSetState(true, false,false); 
>               //      GsiSetShiftState(glfCapsLock,glfCapsLock);
>                       handled = true;
>                       break;

GrfSetState() should work; try w/o the GrfInitState().  Here's what I
use; it works for me for OS 1.0 through 3.5:

#include <Graffiti.h>
...

  FooFormHandleEvent(EventPtr event)
  {
    static Word     tempState ;
    static Boolean  capsState, ignore ;

    ...
      case frmOpenEvent:
       /* save current Graffiti shift state */
        GrfGetState(&capsState,&ignore,&tempState,&ignore) ;
        ...
        FrmDrawForm(form) ;
        GrfSetState(true,false,false) ;  /* set caps lock */

        handled = true ;
        break ;
    ...

      case ctlSelectEvent:
        ...
          case FooOkayButton:
            ...
           /* restore Graffiti state and return to main (previous) form */
            GrfSetState(capsState,false,false) ;
            FrmReturnToForm(0) ;
            ...
     ...
  }

The call to GrfGetState() on frmOpenEvent is so that you can restore
Graffiti to its previous state when you leave the form (if you're
doing this in your main form, then you don't need to worry about
saving and restoring the Graffiti state); this isn't necessary for
setting the shift state though (and doesn't always seem to work
reliably across all OS versions).

Hope this helps,

John

-------------------------------------------------------------------------
John Valdes                        Department of Astronomy & Astrophysics
[EMAIL PROTECTED]                               University of Chicago

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