RE: [gtkmm] Double Window Hell
- From: Dennis Craven <linuxnewb rogers com>
- To: Murray Cumming Comneon com
- Cc: gtkmm-list gnome org
- Subject: RE: [gtkmm] Double Window Hell
- Date: Tue, 16 Dec 2003 13:32:55 -0500
On Tue, 2003-12-16 at 08:54, Murray Cumming Comneon com wrote:
> If the "main" window is not in the .glade file, and is not in his
> application, then I can't imagine where is coming from. I suggest grepping
> for "main".
This is the same line of thought I had.. The only "main" in my source
code was the function named "main". I thought I had better leave that
there :)
Anyways, I did get around it. I don't know if this is the proper way to
do it, but in case anyone is searching these archives for the same
problem, this is what I did:
In main.cc:
#include "MyWindow.hh"
int main(int argc, char ** argv)
{
Gtk::Main kit(&argc, &argv);
MyWindow mainWindow;
mainWindow.run();
return (0);
}
In MyWindow.hh:
#include <gtkmm.h>
#include <libglademm/xml.h>
class MyWindow : public Gtk::Window
{
public:
MyWindow();
virtual ~MyWindow();
virtual void run(void);
protected:
Glib::RefPtr<Gnome::Glade::Xml> refXml;
};
In MyWindow.cc:
#include "MyWindow.hh"
MyWindow::MyWindow()
{
Gtk::Window * main = 0;
refXml = Gnome::Glade::Xml::create("gotter2.glade");
}
MyWindow::~MyWindow()
{
}
void MyWindow::run(void)
{
Gtk::Main::run();
}
As you can see, I merely moved the Gtk::Main::run() function call into
the MyWindow class and just called it from the main function. It appears
to work fine, but like I said, I'm not sure that this is the appropriate
solution. The .glade file is untouched since I first emailed the list
about this issue, and the window is obviously functionless, but that is
something I can work on now.
If anyone sees any potential problems with this solution, please let me
know. If I come across any myself, I'll notify the list of the
correction so that the archives are accurate. If you guys think the
solution is sound, I'll make up a little gtkmm/libglademm tutorial once
I make more progress and produce some content.
Thanks for the help,
~arker
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]