Canvas, drag & drop, widget items



Hello all.

This question is about the gtk-canvas in GTK 1.x (almost the same as the gnome-canvas, I think).

I'm using the canvas to place some icons on it and to do some drawing and drag&drop operations (I draw lines and rectangles). The icons are actually a pixmap inside an eventbox, the eventbox is packed inside a vbox, and the vbox is placed inside a gtk_canvas_group to put it in the canvas.

Ok, so now I need to drag&drop the icons within the same window and from one window to another, that works fine (drag-begin and drag-motion connected to the eventbox, drag-drop connected to the canvas), but then I need to drag an icon and drop it over another icon (like when in a file manager you want to drop a file inside a folder), that's where the trouble shows up.

To do the later operation I have drag-begin and drag-motion connected to the eventbox and drag-drop connected to the other event box, the signals work fine and I have no problem with them, but in the drag-drop handler function I'm calling gtk_object_destroy on the dragged GTK_OBJECT(canvas group) which contains the vbox->eventbox->pixmap and that destroys and erases the source icon (the desired effect) but also erases the pixmap in the target eventbox (actually it only erases the part of the target pixmap covered by the source icon). Shouldn't the canvas take care of the redrawing? and even if it doesn't I cannot get the pixmap redrawed by calling functions like gnome_canvas_update_now, gnome_canvas_request_redraw, etc.

Another problem I'm getting in my app, is that I cannot drop over icons that where drawed in the canvas after the source icon was drawed, so for instance, if I create and draw an icon for a file (in the file manager example) and after that I create and draw an icon for a folder then the folder's icon is always in top of the file icon and there's no way to perform the drop over it. I cannot use the canvas functions like gnome_canvas_item_raise_to_top because that doesn't works with widgets inside the canvas.

Thanks,
Jose Diago.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]