[Gtk-sharp-list] Editable label widget and custom CellRenderer?

Philippe HANRIGOU filou@hotpop.com
15 Dec 2002 23:10:05 -0800


I have just downloaded mono-0.17 gtk-sharp-0.6. Everything seems to be
working really well (except GStreamer bindings, but this is not an issue
for now). I really appreciate to be able to program a GTK application in
a high level language and without having to do all the "make C behave as
an object oriented citizen" massaging. Thanks guys for making this

Nevertheless I quickly reached one of the current limitation of
gtk-sharp. Apparently there is no easy way to create your own custom GTK
widget in C# (I tried on my own for a while, then checked gtk-sharp-list
and a message confirmed that it was not currently possible). Of course I
could write the custom widget in C and then use it under C#. But that
sounds complicated and cumbersome (to me at least). That's why... I hope
there is no need to write a custom widget in the first place!

The widget I'd like to have would be a widget that:
- Look as a label most of the time (no enclosing rectangle in
- Can be selected (style selected bg / style selected fg) when clicked
- Behave and look as a text entry widget when double-clicked

Is there a way to implement this with gtk-sharp and without writing a
custom widget? I am fairly new with C# and the GTK API so please excuse
me if that sounds trivial. My first idea was to change dynamically the
content of an HBox (label/entry) on a clicked event, but apparently you
cannot do this with GTK (Is this correct?). Then I tought about packing
a label and a text entry in a HBox and make them visible only one at a
time. Unfortunately I did not succeed: the HBox was displaying the text
entry whether or not I was setting the Visible attribute to false. Am I
missing something?

Any idea / pointer to some documentation / code samples would be welcome

Finally is it possible to implement your own CellRenderer in "pure
gtk-sharp", or, like I suspect, the problem is the same as with custom
widgets (no underlying GLib compatible type when you subclass

Thanks in advance!