Re: [gtk-list] GtkCList: How to get current selection?



>From: "David Z. Maze" <dmaze@donut.mit.edu>

>Presumably a GtkCList keeps as internal state the currently selected
>row(s) (if any).  Is there any way for an application to find this
>out, preferably without using the members of the GtkCList struct?

You're gonna hate me for this answer but I'm sorry I cant help it. 

Use this:

     ...
     GList *sList;
     int rNum;
     ...

     sList = GTK_CLIST(clist)->selection;
     while(sList){
          rNum = (int) sList->data
          sList = sList->next;

           /* 'rNum' is the row number of selected row
              Do whatever you want to */
     
     }


By the way, this is NOT the ONLY thing for which one has to rely on the 
internal structure of GtkCList. Recently I have been in need of a whole 
bunch of information like the current width of a column, the current 
title, and the current justification (just to enumerate a few). All of 
them have to be grabbed directly from the structure. 

I hope we will see (some day) a C++ style 'get_ / set_' convention for 
such data items.

-kaq

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com



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