Re: Text of a gtk_ctree_node



On Thu, 24 Aug 2000, Ottavio Campana wrote:

> On Thu, Aug 24, 2000 at 03:18:19PM +0500, Vlad Harchev wrote:
> > gint        gtk_ctree_node_get_text         (GtkCTree *ctree,
> >                                              GtkCTreeNode *node,
> >                                              gint column,
> >                                              gchar **text);
> 
> excuse me, but I've got a stupid question....
> I've got a ctrre with only one column and I've got some problems with my
> code:
> 
> void
> on_button6_clicked                     (GtkButton       *button,
>                                         gpointer         user_data)
> {
>         char **string;
>         int i = 0;
>         GtkWidget *tmp;
>         GtkWidget *node;
>         if ((GTK_CLIST (ctree1)->selection != NULL) && (GTK_CLIST (ctree1)->selection->data != NULL)) {
>                 tmp = GTK_CLIST (ctree1)->selection->data;
>                 node = gtk_ctree_find_node_ptr (GTK_CTREE (ctree1), GTK_CTREE_ROW (tmp));
>                 gtk_ctree_remove_node (GTK_CTREE (ctree1), GTK_CTREE_NODE (node));
>                 i = gtk_ctree_node_get_text (GTK_CTREE (ctree1), GTK_CTREE_NODE
> (node), 1, string);

 No, you have to define 
	char* string; /*not 'char**' !*/
and pass address of this variable so it will be set by gtk, i.e.:
                 i = gtk_ctree_node_get_text (GTK_CTREE (ctree1),
	GTK_CTREE_NODE (node), 1, &string);/*note '&string' */

 Also, you are removing the node (and its text) before getting the text for
some unknown reason. If you really need to delete that node,first get text,
than strdup() it, and after that delete it.

>                 g_message (string);
>         } else {
>                 umounting_error_messagebox = create_messagebox_error_umounting ();
>                 gtk_widget_show_all (umounting_error_messagebox);
>         }
> }
> 
> You can imagine, ctree1 is a global variable.
> I've   declared   char   **string   and  used   it   it   the   function
> gtk_ctree_node_get_text ,  but what  do I  have to do  to print  it with
> g_message ?
> 
> Bye
> 
> -- 
> Non c'è più forza nella normalità, c'è solo monotonia.
> 

 Best regards,
  -Vlad






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