Re: drag and drop with clist
- From: Dan Espen <dane mk telcordia com>
- To: Mike Nielsen <miken bigpond net au>
- Cc: Gtk-Perl List <gtk-perl-list gnome org>
- Subject: Re: drag and drop with clist
- Date: Wed, 19 Feb 2003 14:54:16 -0500
Mike Nielsen <miken bigpond net au> writes:
Dan,
Well done!
Would you mind posting a sample of how you made it work?
If you'd like a complete program, I think I could be convinced
to upgrade the clist example at:
http://personal.riverusers.com/~swilhelm/gtkperl-tutorial/clist.html
which is what I've been using to learn from or something else.
Otherwise, here are the necessary parts:
$clist->set_reorderable($true); # allow drag/drop
$clist->signal_connect('row_move', \&RowMove );
sub RowMove {
my ($widget,$row_from,$row_to) = @_;
my @chunk=splice @AoA, $row_from, 1; # extract piece
splice @AoA, $row_to, 0, @chunk; # put it back
}
In this case, @AoA has my application data which I need to
keep in the same order as the displayed list.
This is only lightly tested, but it seems to be doing the job.
Its so simple, I don't know why everything else I looked at
seemed so complicated.
--
Dan Espen E-mail: dane mk telcordia com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]