Re: SimpleList drag and drop

On Tue, 19 Sep 2006 07:20:17 +0200
"Ratcliffe, Jeffrey (Peters)" <Jeffrey Ratcliffe External eads com> wrote:

The following example knows when the list is being dragged, but I despite searching this list and playing 
with the example, I cannot get it to tell me that it has been dropped.

I would be very grateful for (even more) advice.

Hi, I'm no expert on this, but read "perldoc Gtk2::Widget" for the
drag-n-drop callbacks.

Usually, you don't drop onto the same widget, but for your example

$slist->signal_connect("drag_drop" => sub { warn "dropped\n";  } );

#!/usr/bin/perl -w

use strict;
use Gtk2 -init;
use Gtk2::SimpleList;

my $win = Gtk2::Window->new;
$win->signal_connect (delete_event => sub { Gtk2->main_quit; });

my $vbox = Gtk2::VBox->new;
$win->add ($vbox);

my $slist = Gtk2::SimpleList->new ( 'Int' => 'int', 'Text' => 'text' );
@{$slist->{data}} = ( [1, 'text1'], [2, 'text2'], [3, 'text3'] );
$slist -> set_reorderable( 1 );

$slist -> signal_connect("drag_data_received" => sub {
warn "dragged!\n";

$vbox->add ($slist);

gtk-perl-list mailing list
gtk-perl-list gnome org

I'm not really a human, but I play one on earth.

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