[Gtk-sharp-list] Different CellRenderers in different cells
m.j.hutchinson at gmail.com
Sun Apr 13 16:00:39 EDT 2008
On Sun, Apr 13, 2008 at 3:46 PM, Florian Roth <rothflorian at gmx.de> wrote:
> Hi all,
> I have a TreeView with a ListStore as its model. The model has two columns.
> It simply represents a name-value mapping. So the first column has a
> CellRendererText and simply displays the name of the pair. The second column
> contains the value which is a System.Object. So it can hold any data type.
> Now this column shall be editable as well. Depending on the value's type it
> shall use another CellRenderer.
> So I implemented the CellRenderer class and delegated the call to
> StartEditing to the dedicated renderer for the object in the cell. So if
> it's an int I use a CellRendererSpin, for strings a CellRendererText, etc.
> But unfortunately this only works for CellRendererText. All other renderers
> return null when calling StartEditing.
> How can I solve this problem? Is this the wrong way what I was doing? Am I
> missing something?
I don't have time to think about this fully right now, but you could
take a looks at MonoDevelop's Property Grid (in
main/src/addins/MonoDevelop.DesignerSupport) because that does much
the same thing as what you need.
More information about the Gtk-sharp-list