Re: CTree get_text (was RE:setting object data (how do I?))

On 06/27/01 Jim Edwards wrote:
According to the fine reference documentation $node->row->parent
should return a node and you can poke inside that.

I don't mean to be a pain in the neck , I'm poking through all the
documentation i can find, along with the .pm and .xs files from the
distribution.  But sometimes, even when I find the answer I don´t
recognize it.  :-) Perhaps you could tell me where you found this
particular gem?

man Gtk::reference
You need XML::Writer/Parser when you build Gtk-Perl to have it.
I don't see anything renamed to titles there: a node contains the
text of all the columns (if they are text columns, that is).

The Gtk API refers to this field as "text" , in  insert_node_defaults
(undocumented as far as I can tell) you call it "titles".  Not a big

Well, it's possible that at the time the widget was bound, the
argument was called titles... Anyway insert_node_defaults()
accepts also text, now.

get_node_info() returns all the info you could set on the cell:
($text, $spacing,  $pixmap_closed, $mask_closed, $pixmap_opened,
        $mask_opened, $is_leaf, $expanded) = $ctree->get_node_info ($node);

In scalar context you just get the text.

Sorry, I goofed here, it returns the last element of the list
returned (there is no array context in perl...).

Not true.  In scalar mode you get a count of the number of defined
values returned.  To get just the text you can do

($text) = $ctree->get_node_info ($node);

which is still array mode.

Nope, see above, we were both wrong:-)

set_row_data/get_row_data can be used in a Gtk::CList that is a parent
class for Gtk::CTree, but should not be used in a Gtk::CTree.
I should probably add a sub Gtk::CTree::set_row_data {die} to
prevent people from using it....

Or you could overload the xs for node_set_row_data / node_get_row_data
so that they do what you might expect them to do.

I don't understand what you mean here. set_row_data() receives row
numbers, but there is no such thing in a Gtk::CTree, only nodes.
So set_row_data is useless in a CTree.

Lupus (Gtk-Perl maintainer) suggested 5 Dec 1999:
gtk_ctree_node_get_text() works only when the node is a text node.
You should use gtk_ctree_node_get_pixtext() if it's a pixtext one,
and so on.
Anyway, I added gtk_ctree_get_node_info() to the bindings.

So does insert_node or default_insert_node always give you a pixtext
node?  How do you get a text node or even distinguish between pixtext
and text nodes?  Are there also other types of nodes?

With insert_node() you get a pixtext cell in the column $tree_column
and a text cell in the others.

Gtk::CellType $ctree->node_get_cell_type ($node, $column)
gets you the type of the cell, and that can be: empty, text, pixtext,
pixmap and widget (though widget is actually unimplemented).

Thank you very much for your patience, I think you have a great tool,
can I help make it better?

Write documentation, find bugs or unimplemented features,
advocate it, optimize it (though nowadays the bottleneck
speed and memory wise is mostly perl itself...).
Any contribution is welcome.


lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better

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