Re: CList Question...



On Tue, 21 Aug 2001 15:32:24 -0400 (EDT), Chris Elston said:

I apoligize if this is a common or boring question...
 
 I'm working with the GtkCList widget for several aspects of an application
 that I am currently working on.  For the most part, it's working great but
 I'm having a slight problem.  Most of my CLists are using a select mode of
 single or browse and I'm trying to find a method of retrieving which ever
 single row is currently selected.  There appears to be a way in the old,
 depricated GtkList widget which is:
 
 GList *currentlySelected = GTK_LIST(myList)->selected;


For the GtkCList it saves the currently selected row number(s)
in member GList *selection and *selection_end.

So to get the selected rows you would:

gint row = -1;
GList *glist = clist->selection;

while(glist != NULL)
{
        row = (gint)glist->data;
        glist = glist->next;
}

So now you get the oldest selected row. There's a more efficient
way to just use selection_end as the starting point ofcourse.

Remember row numbers start at index 0, -1 means none selected
in this example.



-- 
--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
.__                          ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/






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