matthiasm wrote:
> Are you referring to Drag'n'drop?

I'm afraid yes.

> If you did implement your own DND, then I would need to see some of
> your code - reduced to the essentials - to help you more.

Here's a part of the code reduced to the (very very) minimum.
I hope it will be enought significant for you to see what's wrong.


int Toolbar::handle(int e)
{
  static int xOff = 0, yOff = 0;

 switch(e)
   {
     case FL_PUSH:

     if(Fl::event_button() == FL_LEFT_MOUSE) //set the offsets in order
     {                                     // to draging the widget
        xOff = x() - Fl::event_x_root();
        yOff = y() - Fl::event_y_root();
        xPos = xOff + Fl::event_x_root();
        yPos = yOff + Fl::event_y_root();
        xCursOff = Fl::event_x() - x();
        yCursOff = Fl::event_y() - y();
        position(xOff + Fl::event_x_root(),
                 yOff + Fl::event_y_root());
        ...//some code
       }
       return 1;

     case FL_RELEASE:

       //some code relative to initializing flags

       return 1;

     case FL_DRAG:
      if((Fl::event_state()&FL_BUTTON1) == FL_BUTTON1)
      {
       //there's a lot much more code here but it could be
        //resumed to: draging the widget.

          position(xOff + Fl::event_x_root(), HMENUBAR);
          xPos = xOff + Fl::event_x_root();
          yPos = yOff + Fl::event_y_root();
          this->redraw();

      }
       return 1;

     default:
     return Fl_Group::handle(e);
   }
   return Fl_Group::handle(e);
}

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to