Re: why is class HelloWorld : public Gtk::Window ?



Michael Comperchio said the following:
I had a lot of fun with this. When I derive my class from Gtk::Window, and in that class used libglademm stuff to get the window from the glade file, I found I had two windows. This happens with the examples too.

I think that if this happens in the examples, it is done to keep things simple. According to the "Loading the .glade file" chapter[1] of the online book[2], Glade::Xml::create() can also have a second parameter which specifies which widget or window to instantiate. I guess instantiating widgets from glade can also be controlled in this way. The "Accessing widgets" chapter[3] is also very useful to know when widgets are created and destroyed.

[1] http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-libglademm-loading-glade-file.html
[2] http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/index.html
[3] http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-libglademm-accessing-widgets.html

I noticed (finally) that in the example glade files, the window used to layout widgets in was set to visible=no.

When glade creates a widget, its visibility is set to false by default (at least this is so on this system). If you create your own widget, you could probably change that option according to your liking.

And in the example classes the widgets were reparented to the derived class. That got rid of the two windows. I've since given up on Gtkmm and simply went back to Gtk with straight C... I like C better anyway :)

I'm no expert, but I find C++ a lot easier than C just because a lot of the underlying C functionality is abstracted by the C++ features. Also, I hope my comments are useful. :-)

Michael
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


--
José Alburquerque
jaalburquerque cox net



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