Weird Runtime Errors



I'm fairly new to Gtkmm. I've been using Microsoft Visual C++, and have
gotten things using Gtkmm to work, but I've run into some problems in using
the Gtk::Builder class; when I try to run the code:

#include <gtkmm.h>
#include <iostream>

Gtk::Dialog* pDialog = 0;

static
void on_button_clicked()
{
  if(pDialog)
    pDialog->hide(); //hide() will cause main::run() to end.
}

int main (int argc, char **argv)
{
  Gtk::Main kit(argc, argv);

  //Load the GtkBuilder file and instantiate its widgets:
  Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
  try{
	refBuilder->add_from_file("basic.glade");
  }catch(Glib::FileError e){
	  try{
		std::cerr << e.what();
	  }catch(Glib::ConvertError e){
		  std::cerr << e.what();
	  }
  }
  //Get the GtkBuilder-instantiated Dialog:
  refBuilder->get_widget("DialogBasic", pDialog);
  if(pDialog)
  {
    //Get the GtkBuilder-instantiated Button, and connect a signal handler:
    Gtk::Button* pButton = 0;
    refBuilder->get_widget("quit_button", pButton);
    if(pButton)
    {
      pButton->signal_clicked().connect( sigc::ptr_fun(on_button_clicked) );
    }

    kit.run(*pDialog);
  }

  return 0;
}


I catch a Glib::FileError, which has the content of:
Failed to open file '����basic.glade': Invalid argument
However, it doesn't display that so I have to use my compiler's debugger to
see it. Additionally, it throws a Glib::ConvertError that successfully
outputs with the message:
Invalid byte sequence in conversion input

I'm really confused as to why this is happening because
'����basic.glade' is definitely not what I passed to the
add_from_file method.
-- 
View this message in context: http://old.nabble.com/Weird-Runtime-Errors-tp28236918p28236918.html
Sent from the Gtkmm mailing list archive at Nabble.com.



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