Confused about Gtk2::TreeView::get_model()
- From: Joerg Mueller <jfm ram-brand de>
- To: gtk-perl-list gnome org
- Subject: Confused about Gtk2::TreeView::get_model()
- Date: Tue, 04 Nov 2003 21:07:48 +0100
Hi Folks,
In a little app I wrote recently, there is a TreeView widget displaying
a list of machines. I'm using Gtk2 version 1.00. Since the list has to
be reordered via "Up" and "Down" ButtonWidgets I'd like to access the
TreeModel and its method "nth_child".
C API method definition for tree_model:
gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent,
gint n);
Example code from my app:
...
my $treeview = Gtk2::TreeView->new($listStore);
my $model = $treeview->get_model;
my $iter = $treeview->get_selection;
# GET INDEX No IN LIST FROM CURRENT SELECTED ENTRY
my $path = $model->get_string_from_iter( $iter);
my $previous = $path - 1;
my $previous_entry = $model->get_nth_child( $previous_no ); #<< THROWS
EXCEPTION
$model->move_before( $iter, $previous_entry);
print Dumper($treemodel);
...
STDOUT shows "Gtk2::TreeStore=HASH(0x8700210)" ?!?
This is wrong according to the C API definitions:
GtkTreeModel* gtk_tree_view_get_model (GtkTreeView *tree_view);
Did I miss something or got it all wrong?
--
Joerg Mueller <jfm ram-brand de>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]