Thanks Kjell, it works now!


> On 25 Oct 2017, at 19:18, Kjell Ahlstedt <[email protected]> wrote:
> 
> On 10/25/2017 10:40 AM, Tom Schoonjans wrote:
>> Hi all,
>> 
>> 
>> I have a class that derives from Glib::Object that should implement 
>> Gtk::Orientable. I thought it would be sufficient to just do:
>> 
>> class MyClass : public MyParentClass, ::Gtk::Orientable {
>>      public:
>>      MyClass() : Glib::ObjectBase(“MyClass"), MyParentClass(), 
>> Gtk::Orientable() {}
>> };
>> 
>> Even though this compiles without problems, I do get into trouble at runtime 
>> with errors like:
>> 
>> (test1:35777): GLib-GObject-WARNING **: attempting to add an interface 
>> (GtkOrientable) to class (gtkmm__CustomObject_MyClass) after class_init
>> 
>> (test1:35777): Gtk-CRITICAL **: gtk_orientable_get_orientation: assertion 
>> 'GTK_IS_ORIENTABLE (orientable)' failed
>> 
>> (test1:35777): Gtk-CRITICAL **: gtk_orientable_get_orientation: assertion 
>> 'GTK_IS_ORIENTABLE (orientable)' failed
>> 
>> 
>> I have tried changing the order of the parent constructors but that doesn’t 
>> seem to make a difference.
>> 
>> I would be very grateful for any help!
>> 
>> Thanks in advance and best regards,
>> 
>> Tom
>> 
> Have you tried this version? I think i'll work,
>  class MyClass : public Gtk::Orientable, public MyParentClass {
>       public:
>       MyClass() : Glib::ObjectBase(“MyClass"), Gtk::Orientable(), 
> MyParentClass() {}
> };
> 
> You have made Gtk::Orientable a private base class by omitting "public". I 
> don't know if that's possible. Anyway, it's important that Gtk::Orientable 
> goes before MyParentClass in the first line. That's what determines in which 
> order the constructors are called.
> 
> Kjell

_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to