Re: Control on Tree Row collapsing
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Control on Tree Row collapsing
- Date: Sun, 17 Dec 2006 20:04:16 +0100
On Mon, 2006-12-18 at 00:09 +0530, Ashwin Ramachandran wrote:
With the signal for tree-collapse-row, I can now get the path and iter
of the row collapsed.
but how do I use that information to get information on whether that
path[ie DEF] is the parent
or parent's parent for 456[Assuming I have information pertaining to
the iter and path of 456].
Is there any direct API to verify that?
I checked ancestor and descendant, but both do not seem to work.
I think Gtk2::TreePath::is_ancestor or Gtk2::TreePath::is_descendant
should work. Are you sure they don't do what you want? Untested code:
$view->signal_connect(test_collapse_row => sub {
my ($view, $iter, $path) = @_;
my $selected_iter = $view->get_selection->get_selected;
my $selected_path = $view->get_model->get_path ($selected_iter);
if ($path->is_ancestor($selected_path)) {
# ask the user and return TRUE or FALSE accordingly
}
return TRUE; # allow collapsing
});
(For the record: displaying a modal dialog simply because the user
collapsed a row seems rather strange. There's no potential for data
loss and nothing happened that can't be reversed easily. So I don't see
the need to get in the way of the user.)
--
Bye,
-Torsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]