On Fri, 23 Jan 2015 10:27:04 GMT, King_DuckZ wrote:

On Thu, 22 Jan 2015 22:35:28 +0100, Mike Wey wrote:

  • How is one supposed to inherit from classes the whose objects are automatically created by Builder?

I don't think you can, GtkBuilder wouldn't know how to instantiate the
derived class.

What about my MyWindow example? That way I can customize the window class, if only I could copy-construct its base class from the ApplicationWindow returned by the builder. Any way I can do that?

I've always solved this situation with 'reparenting':

class MainWindow : Window, View {
private void prepare_ui () {

// The very first widget inside the window, this box holds all the
// other widgets
Box b1 = cast(Box) mbuilder.getObject("box1");

// Now one by one get the other widgets inside box1...

// FileChooser buttons
mimagechooser = cast(FileChooserButton) mbuilder.getObject("imagefilechooserbutton");
init_imagefilechooser_button ();

mxmlchooser = cast(FileChooserButton) mbuilder.getObject("xmlfilechooserbutton");
init_xmlfilechooser_button ();

// Drawing Area
mpage_image = cast(DrawingArea) mbuilder.getObject("page_image");
if (mpage_image !is null) {
  mpage_image.addOnDraw (&redraw_page);
  mpage_image.addOnButtonPress (&button_press);
  mpage_image.setHasTooltip (true);
  mpage_image.addOnQueryTooltip (&query_tooltip);
// Finally reparent the glade window into this one... //

//alias this Widget;
//alias Widget = this;
b1.reparent ( this );