Re: Text of a gtk_ctree_node

On Sun, 27 Aug 2000, Ottavio Campana wrote:

> On Fri, Aug 25, 2000 at 08:02:56PM +0500, Vlad Harchev wrote:
> >  Looking at the source, it's clear that the number of columns in GtkCTree is
> > returned with the following:
> > 	GTK_CLIST (ctree)->columns
> >  What it's equal to in your case?
> > 
> >  Also, that node should satisfy the following predicate for the meaningful
> > string to be returned:
> > 	GTK_CTREE_ROW (node)->row.cell[column].type == GTK_CELL_TEXT
> >  Is this predicate true for some columns of that node?

> Hi!
> I've done a lot  of tests but I had no result :-(  . I've decided not to
> use gtk_ctree but a gtk_list instead of it. I still have a question (but
> if it works it is the last :-) ).

 Just thinking again about you and your problems - I found that your code
for ctree seems to be incorrect. For GtkCList (which is parent of CTree), 
	GTK_LIST (list1)->selection->data
is the _index_ of selected row (or -1 if nothing selected).
To get CTREE node, you have to use 

  GtkCTreeNode* gtk_ctree_node_nth            (GtkCTree *ctree,
                                               guint row);
And do what you need to do with that node (get text).
Could you check whether all this works? Sorry for so late solution..

 As for using - gtklist - it's deprecated and seems it will be absent in next
major version of gtk, so stick to gtkclist (if you still have to switch after
trying what I said above).
 In case of clist, after you have the index of the row, just call

gint        gtk_clist_get_text              (GtkCList *clist,
                                             gint row,
                                             gint column,
                                             gchar **text);
 To get the text.

> I create  some items with label  and I insert  them in the list.  Then I
> need to remove some items and to get the label back. How should I do it?
> My code is:
> GtkWidget *tmp;
> if ((GTK_LIST (list1)->selection != NULL) && (GTK_LIST (list1)->selection->data != NULL)) {
> 	tmp = GTK_LIST (list1)->selection->data; 
> } else {
> 	...
> }
> what should I  do after getting tmp to have  first the gtk_list_item and
> then the label of it?
> Bye
> -- 
> Non c'è più forza nella normalità, c'è solo monotonia.


 Best regards,

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