Re: [gtkmm] Confused with TabElem
- From: "Andreas B. Thun" <abt gmx de>
- To: Daniel Pixley <danpixley cox net>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Confused with TabElem
- Date: Sat, 13 Mar 2004 11:51:59 +0100
Hi,
I remove pages from my notebook with:
int cPage = m_Notebook.get_current_page();
m_Notebook.remove_page(cPage);
I add them with:
string notebookTabName;
notebookTabName.assign("tabNameonly20charslong", 0, 20);
m_Notebook.append_page(*NotebookWidgets, notebookTabName);
m_Notebook.show_all_children();
m_Notebook.set_current_page(-1); // activate last page
// do not swap these lines
I am trying to implement a dynamic notebook (adding and removing tabs to
a notebook during runtime). I'm using the 'Notebook_Helpers::TabElem()'
approach to this, since this seems to be the best way to go about it
(?). However, I am having trouble understanding the logic and usage of
TabElem(). Here is what I have so far:
Gtk::TextView *textview = Gtk::manage(new class Gtk::TextView());
Gtk::ScrolledWindow *scrolledwindow = Gtk::manage(new class
Gtk::ScrolledWindow());
Gtk::Label *label = Gtk::manage(new class Gtk::Label("Test"));
Gtk::Image *image = Gtk::manage(new class
Gtk::Image(Gtk::StockID("gtk-close"), Gtk::IconSize(4)));
Gtk::Button *button = Gtk::manage(new class Gtk::Button());
Gtk::HBox *hbox = Gtk::manage(new class Gtk::HBox(false, 0));
... Do stuff to initialize the above widgets,including the following 3
lines:
button->add(*image); // This is a small close button
hbox->pack_start(*label, Gtk::PACK_SHRINK, 10);
hbox->pack_start(*button, Gtk::PACK_SHRINK, 0);
notebook1->pages().push_back(Gtk::Notebook_Helpers::TabElem(*scrolledwindow, *hbox));
show_all_children();
notebook1->set_current_page(-1);
-------------------------------------------------------------------------
Obviously I am doing this wrong. When I test this code, the tab gets
added during runtime as expected, but none of the widgets that are
supposed to be inside of the tab page are there (including the hbox
containing my label and close button). My question is, how do I use
TabElem to add pages that contain widgets? Additionally, how do I
access widgets inside of the page later on? I searched the archives,
and there doesn't seem to be much info on this. Does anyone know of a
tutorial that is more extensive than the Gtkmm.org tutorial? Any help
would be very appreciated. I am new to Gtkmm, but am having fun
learning this library. Any tips on my code is appreciated too. :)
Thanks in advance,
Dan
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]