Re: How-to derive from Gtk::Builder?
- From: Markus Kolb <markus kolb+gtkmm tower-net de>
- To: Kjell Ahlstedt <kjell ahlstedt bredband net>
- Cc: gtkmm Mailinglist <gtkmm-list gnome org>
- Subject: Re: How-to derive from Gtk::Builder?
- Date: Fri, 31 Jul 2015 19:25:59 +0200
Am 2015-07-31 16:37, schrieb Kjell Ahlstedt:
A derived Gtk::Builder must have its own constructor and create()
method or methods. See ExampleApplication in
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/menus/main_menu
for an example.
But I recommend another solution. You say that "there seems to be no
way to get the widget name in the derived widget." That's not true.
What you really mean, I guess, is that there is no way to get the
widget name into*the constructor* of the derived widget. When you
derive a widget, you can give it any methods you like, e.g. an
init(const Glib::ustring& name) method where most of the
initialization is done.
DerivedWidget* pWidget = nullptr;
refBuilder->get_widget_derived(widget_name, pWidget);
if (pWidget)
pWidget->init(widget_name);
Kjell
Kjell, thanks a lot so far.
I think it will help.
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]