get text from GtkCTree





In the mail dated : Fri, 25 Jan 2002 17:10:35 +1100
Ishan wanted to know how to get the text from a GtkCTree.
James Cameron replied :
void
on_tree_select_row                     (GtkCTree        *ctree,
                                        GList           *node,
                                        gint             column,
                                        gpointer         user_data)
{
  gchar *text = gtk_ctree_node_get_row_data
(ctree,GTK_CTREE_NODE(node));
}

a) What does "Glist *node" contain ?
b) What does the pointer returned from   "gtk_ctree_node_get_row_data(...)" contain ?
c) When I used it in my application, it returned NULL.
I used the following construct to try to get the text.
void
on_tree_select_row                     (GtkCTree        *ctree,
                                        GList           *node,
                                        gint             column,
                                        gpointer         user_data)
{
gchar *text;
text = g_malloc(25);                    // allocate memory to hold text
gtk_ctree_node_get_text(GTK_CTREE(ctree),GTK_CTREE_NODE(node), 0, &text);
g_print("\n Content = %s",text);        // Print the retrieved text on screen
}
Is the argument "GTK_CTREE_NODE(node)" right ?
The above mentioned get_text(...) function returns TRUE if text is present
but here it returns FALSE even when text IS Present ?
Where am I going wrong ?
Any other method to get the text from a CTree ?

SOMEBODY HELP ME !


Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com



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