Re: Editable toggle (checkbox) in a GtkTreeView?



> On Sun, 2003-09-21 at 10:07, Pierre Sarrazin wrote:
> > Hi.  I want a GtkTreeView with an editable text column and an
> > editable "toggle" (checkbox) column.  My current code has the former,
> > but the latter does not work yet.  Here is how the two columns are
> > added to the view:
    [...]

Dixit Mikoyan <miko2 at pandora dot be> (2003-09-21 16:29):
> Use the toggled signal on the renderer like this :
> 
> g_signal_connect (G_OBJECT(renderer), "toggled", G_CALLBACK
> (your_callback), NULL);
> 
> "your_callback" would look like this :
> 
> static void your_callback(GtkCellRendererToggle *cell,
>                gchar *path_str,
>                gpointer data)
    [...]

> I don't remember where I learned this, but I think it was from the
> gtk-demo though.

Thanks.  I glanced at the gtk-demo code too fast, and failed
to understand that it is necessary to attach a callback to the
"toggled" and "edited" signals in order to save the user's changes
in the model.  Without such a callback, the changes are lost...

That was a bit surprising, because a somewhat similar widget like
GtkEntry does not need a callback to be editable and to keep the
user's changes.  Oh well.

-- 
Pierre Sarrazin <sarrazip at sympatico dot ca>



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