Re: How to show new window?
- From: Jeff Simpson <llcooljeff gmail com>
- To: "Amadeus W. M." <amadeus84 cablespeed com>
- Cc: gtkmm-list gnome org
- Subject: Re: How to show new window?
- Date: Wed, 19 Oct 2005 14:50:22 -0400
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.
It's not that I wanted to pop the second window up from main, just
that that was how the first one was popped up, so I assumed the second
would be the same way (which isn't the case, as I see now)
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.
Well, right :-P
But the way that glade creates the widgets, where myWindowName has a public of
myWindowName_glade, which has a public of Gtk::Window and that it generates the code
that pops the first window up, I figured it would be good to stick to same convention that
glade uses, editing the correct files and using the right classes (since there are probably
at least a dozen different ways to do it, with gtkmm, straight gtk, etc)
I got the window to pop up on startup, set it back to being not-visible, and then tried to use Show(),
but it is not able to find window #2 (winConfiguration) from within window #1 (winOscilloscope):
winOscilloscope.cc(631): error: identifier "winConfiguration" is undefined
winConfiguration->Show();
I've made the window public, that didn't seem to change anything. The window is instantiated in
the main() function with the following:
winConfiguration *winConfiguration = new class winConfiguration();
I'm guessing that "winConfiguration" is not available within the other window, and I'm not sure
how to go about making it so. Would I have to pass it in somehow, or do I need to move the
instantiation into the other window somehow? I wish there were a good up-to-date tutorial on
these basic concepts online somewhere, but I've searched far and wide only to find outdated
information. Thanks very much for the help!
- Jeff
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]