custom widget with custom property


I'm trying to create a custom widget with a custom enum property.
I managed to do that, and it appears in glade, I can choose from the property values, and it saves it correctly to the .glade file. (actually it's a gtkbuilder file just with .glade extension.. whatever).

But when I start my program, it sets all the properties correctly from the .glade file except mine.

Debugging shows, that this function:
void custom_set_property_callback(GObject* object, unsigned int property_id, const GValue* value, GParamSpec* param_spec)

is called when the property is being set. When it gets to my custom property, in this line: if(Glib::ObjectBase *const wrapper = Glib::ObjectBase::_get_current_wrapper(object))

Glib::ObjectBase::_get_current_wrapper(object) will return NULL, so it won't set the property. And as I realized the custom widget is only instantiated _AFTER_ it tries to set the property (This can be the main cause of not setting it).

Have you got any idea why is this happening?


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