Re: XForms: Redirecting events

From: Steve Lamont (spl@ncmir.ucsd.edu)
Date: Mon May 07 2001 - 10:09:00 EDT

  • Next message: James D. Stegeman: "XForms: strip charts"

    # To subscribers of the xforms list from Steve Lamont <spl@ncmir.ucsd.edu> :

    > Actually, I create a window GL "A" with fl_glwincreate, on which I
    > define a callback for every kind of event using fl_add_event_callback.
    >
    > I create also forms, let's say a form B with some input
    > fields.
    >
    > Then, I wanna treat SOME of the KeyPress events of the A GL window
    > as if they were raised in the XFORMS B window... that is: put into
    > the input fiels of the B window the text that was typed in the A window.
    >
    > To me, this could be achieved by calling when necessary the B
    > window callback from the A window callback, with the event received... But
    > I don't know how to call a form callback !

    You could use XSendEvent() to send your events, as per the following
    example:

                [...]
            
                fl_add_event_callback( window, KeyPress, handler, fd_form );
            
                [...]

            int handler( XEvent *xev, void *data )
            
            {
            
                FD_form *fd_form = ( FD_form *) data;
                XKeyPressedEvent *xkpe = ( XKeyPressedEvent *) xev;
            
                xkpe->send_event = True;
                xkpe->window = FL_ObjWin( fd_form->input );
                fl_set_focus_object( fd_form->form, fd_form->input );
                XSendEvent( fl_get_display(),
                            FL_ObjWin( fd_form->input ),
                            True,
                            KeyPressMask,
                            xev );
                
            }
            
                                                            spl
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Mon May 07 2001 - 10:16:59 EDT