Re: XForms: KeyPress problems

Miguel Monteiro de Sousa Frade (mfrade@ener1000.dee.uc.pt)
Thu, 23 Apr 1998 12:29:06 +0100 (WEST)

# To subscribers of the xforms list from Miguel Monteiro de Sousa Frade <mfrade@ener1000.dee.uc.pt> :

>
> > Here is the main part of my KeyPress handler:
> >
> > int Keyboard(FL_OBJECT *ob, Window win, int w, int h, XEvent *xev, void
> > *udata){
> >
> > char key[5];
> > KeySim keysim;
> >
> > XLookupString((XEvent *)xev, key, sizeof(key), &keysim, NULL);
>
> Are you sure this is what you have in your program? It shouldn't even
> compile since `KeySim' is not a valid type -- at least not a valid X
> type.
>
> switch(keysim){
>
> case 'z': do_rotation();
>
> Assuming this is just a typo, you also should not be testing on
> `keysim'. `keysim' is an XID and is not an ASCII character.

You are right, it's not "KeySim" but "KeySym".

>
> You want to test on
>
> switch ( key[0] ) {
>
> ...
>
> key[0] will be the first character in the key[] array and shold be
> what you want.

I copied this from an example with MesaGL and Xforms, but I'll try
your suggestion. Thank you for the notice.

>
> Refer to the manual page for XLookupString() for full details on use
> of this function. You may also wish to look at the first volume of
> the O'Reilly series on X programming -- I believe there's a discussion
> of the use of XLookupString() there.
>

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/