Re: XForms: fl_mouse_button problem !

From: Antonio Buitrago (abuitrago@interlab.es)
Date: Thu Mar 15 2001 - 03:09:11 EST

  • Next message: Praveen Thiagarajan: "Re: XForms: fl_mouse_button problem !"

    # To subscribers of the xforms list from Antonio Buitrago <abuitrago@interlab.es> :

    Praveen Thiagarajan escribió:
    >

    > This might be a little simple, but i am sort of stuck. I am using the
    > glcanvas to draw some stuff. Whenever a mouse button event occurs the
    > fl_mouse_button(), inside the callback always returns a 0. Any idea as
    > to what i am doing wrong here.
    >
    > The callback definition is as follows,
    >
    > fl_add_canvas_handler(ui->canvas, ButtonPress, mbutton_cb, 0);
    >

            When you add a canvas handler, you must handle it directly by X, using
    the XEvent.
    Your callback function could be as follows,

     int mbutton_cb(FL_OBJECT *ob, Window win, int w, int h, XEvent *xev,
                    void *ud)
     {
       switch(xev->xbutton.button)
         {
         case Button1:
           printf("LEFT BUTTON\n");
           break;
     
         case Button3:
           printf("RIGHT BUTTON\n");
           break;
     
         case Button2:
           printf("MIDDLE BUTTON\n");
           break;
     
         default:
           printf("%ld\n",fl_mouse_button());
           break;
         }
       return 0;
     }
    _________________________________________________
    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 : Wed Mar 14 2001 - 22:11:46 EST