Re: Drag and drop, inter-widget



On Sat, Oct 13, 2012 at 1:02 PM, John Coppens <john jcoppens com> wrote:
Hello guys,

I've got DnD actually working, between a GtkTreeView and a GtkLayout. I'm using it
to make a scheduler, where the TreeView has the classes to be scheduled, and the
Layout is the actual grid.

Though this works, I can't draw the correct size of the class period in the
layout till I drop the wares, which is when the data exchange takes place. Is there
some way to have a data exchange earlier? Hopefully before the move_over event
starts happening - so I can draw the box with the correct size.

Of course it would be possible to do a parallel mechanism (say save a copy of the data
from the treeview as global info) but I'd rather use the DnD mechanism, as this would
work inter-program too.

Hi,
   I'm interested as well to hear any hacks making this possible...
one of the ideas
I've been toying with and might take up as a weekend project is to
bless GtkTreeView
with animated drop zones. currently the "displaying a line" approach
is... a start
but... nothing great.

In other drag'n'drop scenarios I've found that creating a custom drag
icon is enough,
the size of the icon should usually be the size which the data will use in the
drop target display... allowing the drop target display to animate
"spaces" which will
consume the drop data at drop time without causing any visual jumps/glitches
(see eggtoolbareditor and eggspreadtablednd for examples of that).

The problem is in some scenarios, the drop zone may represent the data
in a completely
different way than it was represented in the drag source... for
instance, imagine dragging
icons from Glade's palette into a h4w treeview with variable row
heights... you really
need to construct a treeview row with the drag source data during the
drag-motion
events in order to animate a "space between rows" properly.

Hopefully for you... your work is high-level enough and your drag
source is in the
same application as your drop target... that means you get to set some pointer
data and work completely around the drag-and-drop GtkSelectionData apis
in order to fetch the "current drag data" at "drag-motion" time anyway...

Cheers,
          -Tristan



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