Le 17/10/2011 13:53, Stefan Salewski a écrit :
> I am working on a configuration file editor for an graphical
> application. Configuration consists of strings, numbers and boolean
> values. About 25 values total.
>
> I can use individual widgets for each property, but for larger
> quantities a listview is a more compact form.
>
> It would we nice to have textentry fields for strings, spin buttons for
> numbers and check boxes for boolean values, all in one column of the
> tree view.
>
> Of course I can pop up dialog windows whenever the user clicks on an row
> of the treeview, but that is not a nice solution when the user wants to
> change more than one value.
>
> With Google, I found some people asking for this, but only one
> complicated solution:
>
> http://kapo-cpp.blogspot.com/2008/05/different-cellrenderers-on-same-column.html
>
> I think it is too complicated for me now, not being an GTK expert. (And
> I am using the Ruby GTK bindings, which may make it difficult to use the
> above solution.)
>
> Is there a better solution or even an example available?
Not sure it's better (actually I just took a small glance at the link),
but there are other solutions.
First, the one used by gconf-editor [1], that consist of a custom cell
renderer that provides the appropriate editable depending on the type of
the value it holds. This is not necessarily the easier way, but it's
quite interesting IMHO.
The other solution I know is to pack all CellRenderer that might be used
for editing, and only make one visible/sensitive, depending on the row's
value type. This is what we current use in the implementation of
Geany's stash editor [2], [3].
IMHO the second solution is the easier one, nut sure it's the bast
though. Hope it helps.
Regards,
Colomban
[1] http://git.gnome.org/browse/gconf-editor/tree/src/gconf-cell-renderer.c
[2] https://github.com/geany/geany/blob/master/src/stash.c#L910
[3] https://github.com/geany/geany/blob/master/src/stash.c#L1051
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list