Re: How to show new window?



On Wed, 19 Oct 2005 09:20:08 -0400, Jeff Simpson wrote:

> I have a question that I can't seem to find an answer to on google.
> 
> I have a program that uses a single window. Using glademm, gtkmm, etc, it
> generated the
> following code for my Main function:
> 
> Gtk::Main m(&argc, &argv);
> 
> winOscilloscope *winOscilloscope = new class winOscilloscope();
> m.run(*winOscilloscope);
> delete winOscilloscope;
> return 0;
> 
> This works well, but now I want to add another window to the program.
> Specifically, I want to make
> a configuration dialog that I can open and close, controlled by widgets in
> the original window. What
> is the correct way to add this into a program that is built with glade? I
> don't see any easy way how
> it's written here, seeing as the main function blocks on m.run. Thanks!
> 
> - Jeff Simpson
> I have a question that I can't seem to find an answer to on google.<br>
> 
> <br>
> 
> I have a program that uses a single window. Using glademm, gtkmm, etc, it generated the<br>
> 
> following code for my Main function:<br>
> 
> <br>
> 
> Gtk::Main m(&amp;argc, &amp;argv);<br>
> 
> <br>
> 
> winOscilloscope *winOscilloscope = new class winOscilloscope();<br>
> 
> m.run(*winOscilloscope);<br>
> 
> delete winOscilloscope;<br>
> 
> return 0;<br>
> 
> <br>
> 
> This works well, but now I want to add another window to the program. Specifically, I want to make<br>
> 
> a configuration dialog that I can open and close, controlled by widgets in the original window. What<br>
> 
> is the correct way to add this into a program that is built with glade? I don't see any easy way how<br>
> it's written here, seeing as the main function blocks on m.run. Thanks!<br>
> <span class="sg">
> <br>
> &nbsp;- Jeff Simpson</span>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list


Open your project.glade in glade-2 and create one more window, the exact
same way you created the first one. If you don't want this second
window to be visible when your program starts, make sure you mark it
as not visible (the Visibility option under the Common tab). When you're
done with the second window, save, build, etc.

Then you pop this second window from the appropriate callback function for
a widget in the first window. Say in the first window you have a button
called OpenDialog, and your second window is called SecondWindow, then you
do

void on_OpenDialog_clicked()
{
	SecondWindow->show(); 
}

I guess your confusion came from the fact that you wanted to pop the
second window from main. And that's not really a glade question, any
gtkmm program will be like that. 

The bottom line is you make it invisible in glade, then you only pop it
from some widget's callback. Glade only creates your widgets, it does not
code the functionality of your gui, you do that.





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