Re: Drag'n'drop problems



John Coppens wrote:

Thanks, Jeffrey, but:

On Mon, 08 Sep 2008 08:19:42 -0600
Jeffrey Barish <jeff_barish earthlink net> wrote:

The first argument only has to match the first argument of the source.

This does not seem to be true. If I replace

  {"GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_APP, 0} // This works

by, eg.:

  {"STRING", GTK_TARGET_SAME_APP, 0}          // Doesn't work

So the string _is_ interpreted somewhere (outside of my program, that is).
To be specific, the drag seems to work, but drop doesn't - no event is
generated in the second case. BTW, it's not just "STRING". I tried with
several other things, like "xml_node_pointer" (which described what I was
doing), but that didn't work either.

I was going to tell you that you are crazy, but when I tried putting
GTK_TREE_MODEL_ROW in my program in place of the arbitrary string that I
was using, I found that the behavior of my program changed to something
bizarre (I get too many signals).  So I am forced to agree that
GTK_TREE_MODEL_ROW is interpreted somewhere.  It's news to me.  I have
always used an arbitrary string that matches in the source and destination
specifications.
 
There is some information in this tutorial:

http://scentric.net/tutorial/sec-dnd.html#sec-dnd-selected-item-info

I had found this tutorial, but was somewhat concerned about the '***needs
revision***' statement, and also, it uses the lowest level of interface,
using x and y coordinates. I tried some versions of this, but couldn't
get it to work. Thinking back now, the problem might have been with the
Target string.

There is also some good information in:

http://www.pygtk.org/pygtk2tutorial/sec-TreeViewDragAndDrop.html

There's a C version of this Python tutorial somewhere (I've downloaded
the C code, but lost the URL). It works well, but only drops are shown,
and then only simple strings. I do commend the python guys though - I'm
tempted to switch to Python just for the better docs.


The problem I'm now stuck with is what to do with the path I receive in
data_received (the destination path). I made a simple (destination) tree,
and get 'drop possibles' like this:

-------------------------> Ok
"Main item"--------------> Ok
-------------------------> No
  -----------------------> Ok
  "Subitem 1"------------> No
  -----------------------> Ok
  "Subitem 2"------------> No

BUT, if I convert those paths into iters, and set some data, I'm
destroying the next existing item. Do I have to insert an item before the
path/iter? I'll try that next. It wouldn't explain why I get a 'possible'
on "Main item" though.

The PyGTK FAQ has some hints:

http://faq.pygtk.org/index.py?req=show&file=faq13.030.htp
-- 
Jeffrey Barish




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