Re: XForms: numlock key in FL_KEYBOARD callback of free objects

Steve Lamont (spl@szechuan.ucsd.edu)
Sun, 2 Aug 98 12:18:13 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> # To subscribers of the xforms list from Simon <th_simon@compuserve.com> :

> For a free object (an editor window), defined as FL_INPUT_FREE and
> obj->wantkey
> set to FL_KEY_ALL I don't get a keyboard event for the NumLock key, which=
> I
> need
> as a "Gold" key for a DEC-EDT-compatible editor, which I implemented insi=
> de
> the free object.

I think you'll have to register a raw callback handler and catch the
event for yourself.

Refer to the Dirty Tricks chapter of the manual for more detail.

DEC-EDT! Ick! :-)

Here's an example:

[...]

fl_register_raw_callback( fd_try->try, KeyPressMask, callback );
[...]

int callback( FL_FORM *form, void *xevent )

{

if ( ( ( XAnyEvent *) xevent )->type == KeyPress ) {

XKeyPressedEvent *xkpe = xevent;

if ( XLookupKeysym( xkpe, 0 ) == XK_Num_Lock )
do_your_numlock_thing();

}
return 0;

}

Note that you'll probably want to filter the event, since XForms
delivers *both* the KeyPress and KeyRelease events, whether you want
them or not.

Yes, it's more than kind of a kluge.

spl

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