Re: [gtk-list] Question about sorting a CLIST



Mon Nov 15 1999, Raul Dias ->
> Hi again,
> 
> I have two questions about sorting a clist.
> The first one.
> 
> Is there any other sorting type, other than ascending and descending?
> Like numeric.  Or I have to implement that in my app?

I had the same problem, so I just cut'n'pasted the code from gtkclist.c
and changed it a bit. Look at the bottom of this message.

Then I just used gtk_clist_set_sort_type to change to the function,
which uses the sort column set by gtk_clist_set_sort_column.

> How do I get the new row number from a selected row after sorting it?
> Is there somerhing like gtk_get_current_selected_row()?
> The closest I got is a function to map x and y to row and column.

There is a field in the GtkClist struct which is called selection.
It is a GList, and its contents are the row numbers of the selected
rows. To get the row number from the data component, use the
GPOINTER_TO_INT () on it.

If the selection mode of the clist is GTK_SELECTION_SINGLE or
GTK_SELECTION_BROWSE, then there could of course be at most one item in
the GList.

	n.

-- 
[ http://www.dtek.chalmers.se/~d95mback/ ] [ PGP: 0x453504F1 ] [ UIN: 4439498 ]
    Opinions expressed above are mine, and not those of my future employees.
		  Skingra er! Det finns ingenting att förstå!

PGP signature



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