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



Paolo Molaro wrote:

$node->row->parent() should work (note that it's possible to
reparent nodes and storing data in the node hashref is not reliable
and should not be used).

lupus


Okay, this works.


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?


????
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
deal.

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.


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.


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.


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?

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

Jim







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