Re: sorting Clist



On Fri, 24 Aug 2001 23:37:18 -0400, Marco Quezada said:

 Are the items in a CList made up of a linked list? I want to sort the
 list and use a selected column parameter as criteria but I'm not sure
 how one would access the items on the list. Are they indexed in some
 sort? The list was created by just appending a series of non organized
 items so the data is not organized in any particular way.

Take a look at the header file gtk-1.2/gtkclist.h.

At the bottom there are prototypes for the functions:

/* the column to sort by */
void gtk_clist_set_sort_column (GtkCList *clist,
                                gint      column);

/* how to sort : ascending or descending */
void gtk_clist_set_sort_type (GtkCList    *clist,
                              GtkSortType  sort_type);

/* sort the list with the current compare function */
void gtk_clist_sort (GtkCList *clist);

/* Automatically sort upon insertion */
void gtk_clist_set_auto_sort (GtkCList *clist,
                              gboolean  auto_sort);


It's been a while since I last used it but you need to
watch the "click_column" signal, when that is clicked you need
to set the sort column and call gtk_clist_sort()... I think.
I'm not 100% sure on this but I am sure it's in the right
direction. :)

-- 
--
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]