Re: XForms: Interaction with images

From: Steve Lamont (spl@szechuan.ucsd.edu)
Date: Fri Apr 07 2000 - 10:04:02 EDT

  • Next message: Steve Lamont: "Re: XForms: Peculiar behavior of fl_get_folder_area()"

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

    > 1)- I have developed, with a previous version of xforms that does
    > not support images, some applications using interaction with
    > freehandler defined as:
    >
    > int freeobject_handler(FL_OBJECT *ob, int event, int mx, int my, int key, void *xev)
    > {
    > switch (event)
    > { case FL_PUSH:
    >
    > printf("mx=%d my=%d\n",mx,my);
    > }
    > return 0;
    > }
    >

    > This application enables me to read the coordinates of a pixel after
    > a mouse click.

    > Now that I have used images with canvas, it did not work. I did not
    > find out yet a way to read coordinates of a selected point inside a
    > canvas.

    If you have created a Canvas object to replace your Free object, then
    you need to install a button handler. Use

            fl_add_canvas_handler( your_canvas,
                                   ButtonPress,
                                   your_button_handler,
                                   your_special_data );

    and then create

            
            int your_button_handler( FL_OBJECT *obj, Window window,
                                     int window_width, int window_height,
                                     XEvent *xevent, void *user_data )

            {

                XButtonEvent *xbutton_event = ( XButtonEvent *) xevent;
                int mx = xbutton_event->x;
                int my = xbutton_event->y;
                
                [...]

    The manual, as always, has the gory details.

                                                            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 : Fri Apr 07 2000 - 10:13:40 EDT