TC sez (in response to Dick Middleton)
> >if you do this keypresses produce FL_MOTION events
> >with a key value 0
>
> This is not quite right. If you don't do this, key will be zero. If
> you do, key will not be zero for each keypressed. Due to the
> stepping event, you'll also receive an FL_MOTION event with key==0.
Hmmmm. I can't make it work either. Here's what I'm doing:
#include <stdio.h>
#include <stdlib.h>
#include "forms.h"
typedef struct {
FL_FORM *try;
void *vdata;
long ldata;
FL_OBJECT *browser;
} FD_try;
FD_try *create_form_try(void)
{
FL_OBJECT *obj;
FD_try *fdui = (FD_try *) fl_calloc(1, sizeof(*fdui));
fdui->try = fl_bgn_form(FL_NO_BOX, 320, 250);
obj = fl_add_box(FL_UP_BOX,0,0,320,250,"");
fdui->browser = obj = fl_add_browser(FL_SELECT_BROWSER,10,20,300,160,"");
fl_end_form();
fdui->try->fdui = fdui;
return fdui;
}
int posthandler( FL_OBJECT *obj, int event, FL_Coord mx, FL_Coord my,
int key, void *raw_event )
{
fprintf( stderr, "event type = %d, key = %02x\n",
raw_event ? ( ( XEvent *) raw_event )->type : -1, key );
return !FL_PREEMPT;
}
int main(int argc, char *argv[])
{
FD_try *fd_try;
fl_initialize(&argc, argv, 0, 0, 0);
fd_try = create_form_try();
fl_show_form(fd_try->try,FL_PLACE_CENTER,FL_FULLBORDER,"try");
fd_try->browser->input = 1;
fd_try->browser->wantkey = FL_KEY_ALL;
fl_set_object_posthandler( fd_try->browser, posthandler );
while ( 1 )
fl_do_forms();
exit( 0 );
}
- - -
All I get is zero for `key' when I press a keyboard key.
When I press a mouse button, `key' corresponds to the mouse button
pressed.
I've tried several variations on the theme and still lose.
This is XForms 0.86, SunOS 4.1.4, on a Sun 4/370 (yes, this old
clunker is still running!).
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/xforms-archive/