Re: custom_widget example not working



>>>Hi,
>>>
>>>i'm trying to create a custom widget. As a starting point I wanted to
>>> look
>>>at
>>>the example in examples/book/custom/custom_widget. But when I run the
>>>example
>>>the custom widget is not displayed.
>>>
>>>Has anyone made the same experience? What could be the cause for that?
>>
>>
>> Yes, it's a new example, and I haven't got it working yet. I welcome
>> help.
>>
>
> I found several postings about custom widgets. The examples of working
> widgets
> did not derive from Gtk::Widget but from a non abstract widget (e.g.
> Gtk::DrawingArea).

For me, GtkLabel is a "custom" widget. It derives almost directly from
Gtk::Widget. I am probably just missing some minor thing to make the
example work.

I'm not sure exactly what DrawingArea is for. Maybe it makes some things
easier. However, it is not used to implement the standard GTK+ widgets.

> Gtk::Widget is designed as a wrapper for an underlying GtkWidget. If you
> subclass Gtk::Widget directly, is it possible that no valid 'gobject_' is
> associated?

No, that is not true.

> If that is true, the only possibility to create a custom
> widget is
> to overwrite all important functions or to create a minimal GtkWidget for
> wrapping.
>
> By the way, where is 'gobject_' defined? I couldn't find the declaration.

It's in Glib::ObjectBase, I think. But that's not relevant to this
problem. You can easily see that gobject_ does indeed have a value.

Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com



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