Re: TreeItem Drag and Drop...



Derek Wueppelmann wrote:

I know I keep bringing this up, but it really bothers me. However before
I send in a bug report I just wanted to verify that this is indeed a
bug. Here is the behaviour I'm experienceing and what I was expecting.

When creating a straight Gtk::Tree I add several Gtk::TreeItems to it.
Each of which has had the $tree->drag_dest_set method called with the
approriate items. And the signal_connect method so that when the event
of drag_data_recieved occurs, a method will be invoked.

The thing is that this seems to work for only the root TreeItem. Any
other TreeItems that this is used for don't work at all. So I can only
drag and drop to the root item. This seems to be a bug since I've seen
programs written in c or c++ that are using Gtk::Tree's that seem to
work perfectly fine. Could I be doing something wrong?
Hi, I haven't tried any of this but AFAIK Gtk::List has been deprecated
for a long time and GtkCList is preferred. Of course all this changes 
with gtk2 and you should use a GtkTreeView instead.

I did see a post that suggests an anonymous sub to use as a signal 
handler for the tree to get drag and drop to work from a Tree to a CList:

  $tree->signal_connect('drag_data_get',sub{
      my ($w,$context, $data, $info, $time) = @_;
      print "drag_data_get\n";
      $data->set($data->target, 888, 666);
      return 1;
  });

and also a way to work out which node the drop happened on:

  sub treeDragDataReceived {
    my $browser = shift;
    my $tree = shift;
    my ($context, $x, $y, $data, $info, $time) = @_;

    (my $row, my $col) = $tree->get_selection_info($x, $y);
    my $treenode = $tree->node_nth($row);
    return 1 if (!$treenode);

    ....


HTH, Dermot




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