drag/drop after sort




Hi,

I'm converting a Gtk1 Clist app to Gtk2 Simplelist.
I've gotten pretty far, but I'm having trouble figuring this one
out.

I've enabled drag/drop so I can rearrange rows
in SimpleList with:

$slist->set_reorderable(TRUE);

which works.

And I've enabled column sorting with:

    $slist->get_column ($i)->set_sort_column_id ($i);
    if ($colSort[$i] eq 'a') {  # alpha
      $slist->get_model->set_sort_func ($i, \&sorter_an, $i);
    } else {
      $slist->get_model->set_sort_func ($i, \&sorter_num, $i);
    }

Which also works.

The problem I have is after I sort by clicking on a column
header, I can no longer drag/drop rows to rearrange them.

I've set up a callback like this:

$slist->get_column ($i)->signal_connect_after( 'clicked', \&ClickColumn );

Which gives me control after a column has been sorted,
but I haven't found the method to call to reenable
drag/drop.  I've tried:

sub ClickColumn
{
  my ($ctree) = @_;             # Gives a Gtk2::TreeViewColumn
  $ctree->set_sort_indicator(FALSE); # turns off arrow, doesn't help
  $ctree->set_reorderable(TRUE); # runs but doesn't help
  $slist->set_reorderable(TRUE); # doesn't help either
  return;
}

-- 
Dan Espen                               E-mail: dane mk telcordia com



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