[Glade-users] clist problems

Stéphane Genaud genaud@icps.u-strasbg.fr
Fri, 29 Jun 2001 12:51:29 +0200


jbrite wrote:
> 
> I'm setting up an application that have a  GtkClist and a button above the
> GtkCList.  When the button is clicked it signals a dialog window.  The dialog
> window has 2 GtkClist.  One has a list of 'items' for the user to select, the
> other have a list of items the user HAS selected, if any.  When the user hits
> the 'apply' or 'okay' button, the selected list will then be added to the
> origanal GtkCList.  At least it would if I didn't have these problems!
> 
> The problem(s)
> 1. getting the 'items' in the dialog clist for the user to choice from.
> 2. put those selected items into the new 'selected' CList.
> 
> I can get the first to to work without glade, but second I cannot get at all.
> 
> any help?
> 
Hi,
i'm not sure where your problem lies :
lets call the main clist A, the clist with items to use B, and the
selected items C. 

It seems not to be in insertion of elements (gtk_clist_insert) in
A,B and C since you already seem to have inserted elements in A.

Is it retrieving the selected rows from B ?

You can grab the content of a clist row with 
gtk_clist_get_text given the row number.

The following piece of code gives the selected
row number (single secletion lists, adapt for mutlple
selections).

gint   selected_row_number(GtkWidget *clist) {
GList  *l;
gint   row=-1;
       for (l = GTK_CLIST (clist)->selection; l; l = l->next) {
           row=GPOINTER_TO_INT (l->data);
       }
       return(row);
}

Hope that helps.

-- 
  Stéphane Genaud                                    
   ICPS, Université Louis Pasteur                   
   Pôle API, Bd. S. Brant, F-67400 Illkirch        
   tel : (33)(0)390244542, 0619058113 (SFR)