Re: [gtk-list] Clist widget question
- From: Elliott Hughes <Elliott Hughes genedata com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Clist widget question
- Date: Thu, 19 Aug 1999 09:40:52 +0200 (CEST)
Aaron Faby <aaron@yourlink.net> wrote:
> Im writing an app that reads data from a text file and
> places it in a clist widget. I need to the user to be
> able to edit list rows, add rows, and remove rows. Im not
> sure of the function to use to figure out which row the
> user has selected in order to remove it or edit it.
you have two choices. you can either attach callbacks
to the select_row (and unselect_row) signals, or you
can poke about with the selection field:
GtkWidget * clist = <get hold of clist>
GList * items = GTK_CLIST(clist)->selection;
for (; items != NULL; items = items->next) {
int row = GPOINTER_TO_INT(items->data);
<do something to this row>
}
both are rather nasty, in one way or another. which is
better depends on your application, though using the
signals means you can avoid poking about with the
widget's implementation at the cost of keeping your
own model of row selection.
--
"Intelligence ... has caused our troubles; but it is not
unintelligence that will cure them." -- Bertrand Russell
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]