Re: why is class HelloWorld : public Gtk::Window ?
- From: Damon Register <damon w register lmco com>
- To: gtkmm-list gnome org
- Subject: Re: why is class HelloWorld : public Gtk::Window ?
- Date: Thu, 12 Feb 2009 09:06:16 -0500
Murray Cumming wrote:
Your window probably just has visible-true in the Glade defnition,
meaning that it is visible as soon as you parse the Glade file. I have
Mine is set to false
never seen the point of that Glade/libglade feature myself - it confuses
many people.
Yes, it does confuse me but I am less bothered by whether or not the
glade window is visible or not and more bothered by the existence of two
windows, visible or not. Now if I understand correctly, this
hello window;
creates one Gtk::Window instance because
class hello : public Gtk::Window
Next, in main()
xml_interface = Gtk::Builder::create_from_file("hello.xml");
creates a second invisible (because visible is False in the Glade
file) Gtk::Window instance. This seems highly illogical to me. It seems
that whether visible or not, that one loaded from Glade file is still
there and just wasting memory. Isn't that so?
So, I believe my two options are
1. don't load everything with the single arg Gtk::Builder::create_from_file
but instead load just the single contain within the main window.
2. delete the extra window after the reparent operation.
I am not thrilled with either option. If I choose option 1 I have a new
problem. the gtk-builder-convert will create something like this
<object class="GtkAdjustment" id="adjustment1">
for a GtkSpinButton and this object is outside of the main window.
This means that when I use this
Gtk::Builder::create_from_file("hello.xml", "layout1");
to load just the container but not the main window, I don't get
the adjustments that are used by widgets within the container. I would
then have to keep track of and load all those adjustments which is too
messy.
Option 2 is a lot easier but it just seems silly to have to do that.
Are there any other options I haven't though of yet?
Because there is this problem with the extra window, is there any logic
to having another create_from_file like this
Gtk::Builder::create_from_file("hello.xml", "hello_main_window");
where it works like the single parameter create and loads everything
_except_ hello_main_window. Then, one could just get the container
widget and add it to the window belonging to the hello class and there
would not be two windows.
Damon Register
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]