Re: Widgets & Notebook, help!!



Jamiil wrote:

I have a skeleton class that will eventually contains all the elementes needed to display and retrieve information from the users.
The class compiles nicely, but when I add it to the Gtk::Notebook the program issues a segmentation fault:

Here is an snip of the program in question.

OS:       WinXP
compiler: MinGW-CPP 3.4.2

namespace jme{
class Contacts : virtual public Gtk::Window{
protected:
      Gtk::VBox* vbox1;
      Gdk::Color* colour;
public:
      Contacts();
      virtual ~Contacts();
}; //class
} //namespace

jme::Contacts::Contacts(){
  colour = new Gdk::Color();
  vbox1 = new Gtk::VBox();

  this->vbox1->set_homogeneous(true);
  colour->set_rgb(0,255,255);

  this->vbox1->modify_bg(Gtk::STATE_NORMAL, *colour);
  this->add(*vbox1);
}
jme::Contacts::~Contacts(){
  delete colour;
  delete vbox1;
}

-----------------------------
namespace jme{
class Jaime : public Gtk::Window
{
public:
   Jaime();
   virtual ~Jaime();

protected:
   ....
   //Child widgets:
   Gtk::Notebook* notebook;
   jme::Contacts* contacts;
   ...
private:
   ...
   //Constructors and Destructor go here
... };//class
} //namespace

jme::Jaime::Jaime(){
 ........
   contacts = new jme::Contacts();
   notebook = new Gtk::Notebook();
   notebook->append_page(*contacts, "Contacts");
 ........
}
jme::Jaime::~Jaime(){
 delete all pointers...
}

TIA

It maybe because you are trying to add a window to a tab of a notebook.
You may want to deruve the Jaime class from maybe a Gtk::vbox and not a Gtk::Window

--
Jason Burchfield
CAS, Inc.
(256) 971-6096
Jason Burchfield cas-inc com




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