Re: Displaying packed widgets
- From: Marco <mscholtn xs4all nl>
- To: jjjj <jalqadir netscape net>
- Cc: gtkmm general discussion <gtkmm-list gnome org>
- Subject: Re: Displaying packed widgets
- Date: Thu, 10 Nov 2005 21:30:57 +0100
On Thu, 10 Nov 2005 15:11:35 -0500, jjjj <jalqadir netscape net> wrote:
I have a class that derives from Gtk::VBox, called jme::Contacts;
jme::Contacts is in turn used by the jme::MainWin class as one of its
attributes, named 'contact'. However, when the object 'contact' is
passed to a Gtk::Notebook as one of its tabs:
notebook->append_page(*contacts, "Contacts");
none of the characteristics of the object 'contacts'(Frame and title of
the frame) are displayed.
Below is a quick snip of the class in question.
=============
#include <gtkmm/box.h>
#include <gtkmm/frame.h>
namespace jme{
class Contacts : virtual public Gtk::VBox{
private:
void HBox1();
void NameFrame();
protected:
Gtk::HBox* hbox1;
Gtk::Frame* frmName;
public:
Contacts();
virtual ~Contacts();
}; //class
} // namespace
#endif
jme::Contacts::Contacts(){
try{
hbox1 = new Gtk::HBox();
frmName = new Gtk::Frame("Name");
}
catch ( std::bad_alloc & x ) {std::cout << x.what() << std::endl; }
this->NameFrame(); //Add more attributes to the frame
this->HBox1(); // Add objects to this->hbox1
}
void jme::Contacts::NameFrame(){
frmName->add(dynamic_cast<Gtk::Widget&>(*lblFirstName));
}
void jme::Contacts::HBox1(){
hbox1->set_border_width(50);
hbox1->pack_start(*frmName, Gtk::PACK_EXPAND_WIDGET);
hbox1->show_all_children(true);
}
You forgot to add hbox1 to contacts
add to jme::Contacts::Contacts():
this->add(*hbox1);
--
Marco
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]