Re: Listbox, Treeview and attaching pointers to rows
- From: Claudio Saavedra <csaavedra alumnos utalca cl>
- To: arto karppinen iki fi
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Listbox, Treeview and attaching pointers to rows
- Date: Thu, 25 Oct 2007 10:08:35 -0300
El miÃ, 24-10-2007 a las 15:04 +0300, Arto Karppinen escribiÃ:
Hi
Lets assume i have a simple, one row listbox.
Row one
Row two
Row n+1
And each row would be attached with a pointer, the same way for example
you can attach user_data to button clicks.
Like this:
Row one -> Data pointer 1
Row two -> Data pointer 1
Row n+1 -> Data pointer 1
And when the user makes a selection i catch the selection changed
signal, take the data pointer and do something with the data.
How would one accomplish such amazing task? Because i see no obvious,
easy way to do it. Currently I'm getting the row index from the iterator
and working my way upwards from that with an array where the correct
data happens to be in the same index.
I'd add a column of type G_TYPE_POINTER to the model, store there my
data, and when I catch the selection changed signal, just get the data
with gtk_tree_model_get () from the appropriate row.
Claudio
--
Claudio Saavedra <csaavedra alumnos utalca cl>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]