XForms: Xforms -interaction and drawings

From: zaatri abdelouahab (zaatri@hotmail.com)
Date: Sat Apr 08 2000 - 12:41:03 EDT

  • Next message: Steve Lamont: "Re: XForms: Xforms -interaction and drawings"

    # To subscribers of the xforms list from "zaatri abdelouahab" <zaatri@hotmail.com> :

    Hello

    I thank you steve for you help. Now the interaction with my canvas works
    pretty well. But I dont know why I cant dram lines over it. For instance,
    in the previous version of xforms I use :
      fl_rect(mx-4,my-4,4,4,30) to draw a square arount the point of coordinates
    mx, my. Now the drawing doesnt appear.
      Here is the test program.
    Thanks for any help.
              A.Zaatri

      /*Tring to built a program----> /yoyo/newimage.c
    A.ZAATRI the 4th April 2000
    ??? But now there is a problem with fl_rectangle???***/

    #include "forms.h"
    #include "stdlib.h"
    #include "stdio.h"
    #include "newimage.h"
    #include "time.h"
    #include "sys/types.h"

    FL_FORM *control;
    FL_OBJECT *obj;
    FL_OBJECT *pic1, *pic2, *text, *obj4;

    /**************************************************************************/

    int my_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;
      printf("x=%d y=%d\n",mx,my);
          fl_rect(mx-4,my-4,4,4,30);
         }

    /*******************************************************************/

    int main(int argc, char *argv[])
    {
      FL_IMAGE *image, *image2;
      FL_OBJECT *obj, *obj3, *pic1, *pic2, *text, *frame1, *mouse, *misc;
    int dis;
    char buf[128], wl[128];
    int wx,wy,sw,sh,sx,sy;

    static FLIMAGE_SETUP setup;
    fl_set_border_width(-2);
       fl_initialize(&argc, argv, 0, 0, 0);

      control = fl_bgn_form(FL_NO_BOX, 800, 800);
      obj3 = fl_add_box(FL_UP_BOX,0,0,800,800,"");

    pic1=obj=fl_add_canvas(FL_NORMAL_CANVAS,10,10,770,470,"");
    fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
    fl_set_object_color(pic1, FL_COL1, FL_COL1);

    pic2 = obj = fl_add_canvas(FL_NORMAL_CANVAS,10,560,770,1040,"");
    fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
    fl_set_object_color(pic2, FL_COL1, FL_COL1);

    fl_add_canvas_handler(pic1,ButtonPress, my_button_handler,0);
    fl_add_canvas_handler(pic2,ButtonPress, my_button_handler,0);

      fl_end_form();

    fl_end_form();

        flimage_enable_pnm();

    image=flimage_load("../picture/wa1.pgm");
    printf("New york1 LOADING :%d\n",image);
    image2=flimage_load("../picture/wa2.pgm");
    fl_show_form(control,FL_PLACE_CENTER,FL_FULLBORDER,"CONTROLS & COMMANDS");

    dis=flimage_display(image, FL_ObjWin(pic1));
    printf("New york DISPLAYING :%d\n",dis);
    dis=flimage_display(image2,FL_ObjWin(pic2));

    while( fl_do_forms());
    return 0;
    }

    /*---------------------------------------*/

    ______________________________________________________
    Get Your Private, Free Email at http://www.hotmail.com

    _________________________________________________
    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 : Sat Apr 08 2000 - 12:56:11 EDT