[glade--]Re: [gtkmm] Double Window Hell

Christof Petig <[email protected]> Mon, 15 Dec 2003 21:50:39 +0100
Newsgroups gmane.comp.gnome.glademm,gmane.comp.gnome.gtkmm
Organization Adolf Petig GmbH & Co. KG
Message-ID <[email protected]>
Dennis Craven schrieb:

Hi Dennis,

at first I thought you were using glademm (the sample code looked much 
like the generated code by glademm). But now on second reading I realize 
that this is not the case (kit is not the name used by glademm for the 
main loop and there's no UI base class).

Libglademm has a method to specify the toplevel widget to create 
(glademm uses this variant but I don't remember it easily). Try this 
one. IIRC of course.

    Christof

======================

The following might be good for the bit bucket but would have been the 
correct answer if you had used glademm.

> On Sat, 2003-12-13 at 09:39, [email protected] wrote:
> 
>>There is a "visible" property in Glade. If it is set then the window will be
>>visible immediately.
> 
> 
> The issue isn't with the window NOT appearing. The window that I want to
> appear does appear. The problem is that the second window is created
> along with my application. Every time I execute my code, two windows
> appear where I only want one. Of the two windows that appear, one is my
> application, and the other is a blank window with the word "main" in its
> title bar. That's the one I'd like to get rid of, but I don't know where
> it is coming from. This window also seems to have control of killing the
> application. Does this make sense?

It makes sense. What Murray does not know is that you use glade-- to 
generate the skeleton for your program.

And since glade-- can not know better it creates sample code for every 
window you define. It is your task to fill in the callback flesh and to 
decide which window to generate during main and which during a callback 
(move the widget include/creation code into the appropriate callback).

So your problem is not with libglademm, your problem lies within a 
missing tutorial for libglademm projects generated by glademm.

Feel free to ask more ([email protected] might be better suited for 
this task) [Murray reads it, too].

    Christof

>>>This is something probably pretty simple, but it is making me 
>>>quite angry. I've used regular GTK+ before, but this is my 
>>>first time using gtkmm and also my first libglade(mm) 
>>>attempt. The problem is that when I execute my code, I get 
>>>two windows; one that I intended on getting, and one that is 
>>>just a blank window with the title "main". It appears that 
>>>the mystery window is dominant, as it is the only one (when 
>>>it's wm close button is clicked) that will kill the application.

glademm choses the first window as the main window (which's destruction 
will end the main loop). Alter the sample code within main and it will 
do what you want.

>>>I don't know if the contents of the .glade file is of 
>>>importance, but it maybe since my code doesn't look much 
>>>different than the examples that came with the packages. 
>>>Could it be that the problem lies in the .glade file? Is 
>>>there any documentation for the gtkmm/libglademm combo? If I 
>>>ever get this figured out, I might write up a simple tutorial 
>>>myself.. Something just to get people started using these two 
>>>packages in unison.