Re: Cannot `dynamic_cast` custom wrapped widget from Gtk::Builder
- From: Josh Bialkowski <josh bialkowski gmail com>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Cannot `dynamic_cast` custom wrapped widget from Gtk::Builder
- Date: Fri, 1 May 2020 16:48:24 -0700
One quick follow-up. I re-read [this page][1] about initialization and realized that I didn't generate or call a `wrap_init` function using `
generate_wrap_init.pl`. So I added that step and am now calling it in `main()` before any using code. This means that I was previously not calling the following:
~~~
Glib::wrap_register(gtk_panzoom_area_get_type(),
&PanZoomArea_Class::wrap_new);~~~
Unfortunately even after generating the `wrap_init` and calling it in my `main()` I continue to get the same error and cannot load the widget with `Gtk::Builder`. Also, since I forgot to mention this before, I'm using gtkmm version 3.22.2 and glibmm 2.56.0 (as distributed with Ubuntu 18.04).
Ok, thanks for trying to help! I'll take a look at the generated code for something in gtkmm and see if it's any different with regard to ObjectBase initialization.
It looks like it does, I'm pretty sure this happens in the `panzoomarea_class_.init()` call:
~~~
PanZoomArea::PanZoomArea()
: // Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(nullptr),
Gtk::DrawingArea(Glib::ConstructParams(panzoomarea_class_.init())) {}
iirc for Builder to work with derived widgets, ObjectBase() needs called with a type name or id. but not sure it explains dynamic_cast failing, so i'll defer to someone more experienced now!
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]