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 <[EMAIL PROTECTED]>

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to