Re: Drag and drop from Gtk::Tree to Gtk::CList



Hi again.

I thank you for the info. It wasn't the return value thou but instead
the $data->set statement that made it work. Apparently you have to set
some data before you can get some data. (Makes sense doesn't it?)


I found another problem along the line.

When the "drag_data_received" gets called i need to find out which row
and column the user released the button. To do this i tried to do the
following

Code:
-------------------------------------------------------------------
$clist->signal_connect('drag_data_received',sub{
        my ($w, $context, $data, $info, $time) = @_;
        my ($x, $y) = $w->get_pointer();
        my ($row, $column) = $w->get_selection_info( $x, $y );
 
        print "drag_data_received x:$x y:$y row:$row column:$column\n";
                               });
-------------------------------------------------------------------

but i always gets actually row+1, and if i drops it at the last row i
get uninitialized value.

Anybody who knows how to get which row and column the mouse was over
when the drag and drop ended?

Regards 
Johan

On Mon, 2002-03-18 at 20:44, Gavin Jefferies wrote:

Hi Johan, I think you have to set the data and return true in the
'drag_data_get' in order to get the 'drag_data_received' to notice the
drop. At least this is the only difference you have to my program
where I have this working.

Try 

$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;
                           });

Gavin

--
Gavin Jefferies. gavin at emptytree.com. http://emptytree.com/



Johan Ankarloo <johan ankarloo volvo com> writes:

Hi

I am trying to get drag and drop to work between a Gtk:Tree and a
Gtk::CList.

The problem that i have is that i can get the "drag_data_get" signal to
work but not the "drag_data_received" signal and it is that signal that
should trigger the actual change in the clist.

Code:
-------------------------------------------------------------------
$tree->drag_source_set('button1_mask', ['copy', 'move'],
{target=>'STRING', flags=>0, info=>0});

$tree->signal_connect('drag_data_get',sub{
    my ($w,$context, $data, $info, $time) = @_;
    print "drag_data_get\n";
                           });
$clist->drag_dest_set('all', ['copy', 'move'],{'target' => "STRING",
'flags' => 0, 'info' => 0});
$clist->signal_connect('drag_data_received',sub{
    my ($w, $context, $data, $info, $time) = @_;

    print "drag_data_received\n";
                           },$name);
-------------------------------------------------------------------


Any idea someone?

Regards

Johan Ankarloo

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list





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