Re: [gtkmm] Widgets within Notebooks
- From: Matthew Walton <matthew alledora co uk>
- To: "Andreas B. Thun" <abt gmx de>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Widgets within Notebooks
- Date: Fri, 26 Dec 2003 12:53:39 +0000
You can't add a widget to two containers at the same time, but you're
doing that with Mainbox here. If you want Mainbox and its contents to be
on a notebook page, you need to add it only to the notebook page and
not to anywhere else.
You should note that if you want to set up multiple notebook pages,
you'll need seperate instances of the widgets to add to each page, as
that would be the same as adding to multiple containers. Not to mention
a little pointless, as the pages wouldn't be different even if it worked.
You'll probably be wanting to use Notebook::append_page() to add pages
to the Notebook, you supply it with a widget to put in the new page
(usually a VBox or HBox with all the necessary widgets packed in it).
Andreas B. Thun wrote:
Thx for your help.... show_all_children() is not the problem
Show the code that's not working.
Here is the major code:
void ConstraintGui::showGui()
{
std::cout << "START ConstraintGui::showGui()" << std::endl;
// Add Tree Browser to VBoxLeft
// m_TreeBrowserBox is already created by my constructor. is there a
function to test if it is valid?
// More widgets for VBoxLeft will come ...
m_VBoxLeft.pack_start(m_TreeBrowserBox);
// Add Table to VBoxRight
// m_TableBox is already created by my constructor. is there a
function to test if it is valid?
// More widgets for VBoxRight will come ...
m_VBoxRight.pack_start(m_TableBox);
// Add MainBox to the main window
add(m_MainBox);
// Add VBoxLeft and VBoxRight to MainBox
m_MainBox.pack_start(m_VBoxLeft);
m_MainBox.pack_start(m_VBoxRight);
// Add the Notebook to the MainBox, with the Quit button underneath
m_Notebook.set_border_width(10);
m_MainBox.pack_start(m_Notebook);
m_ButtonBox.pack_start(m_Button_Quit, Gtk::PACK_SHRINK);
m_MainBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);
// Connect Quit-Button to signal handler
m_Button_Quit.signal_clicked().connect(SigC::slot(*this,
&ConstraintGui::on_button_quit));
// Add MainBox to the Notebook page -> does not work
m_Notebook.append_page(m_MainBox, "First Window");
show_all_children();
std::cout << "END ConstraintGui::showGui()" << std::endl;
}
Output:
START ConstraintGui::showGui()
(guiTest:1783): Gtk-CRITICAL **: file gtkwidget.c: line 3943
(gtk_widget_set_parent): assertion `widget->parent == NULL' failed
(guiTest:1783): Gtk-WARNING **: gtkwidget.c:1489: container class
`gtkmm__GtkWindow' has no child property named `tab_expand'
(guiTest:1783): Gtk-WARNING **: gtkwidget.c:1489: container class
`gtkmm__GtkWindow' has no child property named `tab_fill'
(guiTest:1783): Gtk-WARNING **: gtkwidget.c:1489: container class
`gtkmm__GtkWindow' has no child property named `tab_pack'
(guiTest:1783): Gtk-WARNING **: gtkwidget.c:1489: container class
`gtkmm__GtkWindow' has no child property named `tab_label'
(guiTest:1783): Gtk-WARNING **: gtkwidget.c:1489: container class
`gtkmm__GtkWindow' has no child property named `menu_label'
(guiTest:1783): Gtk-WARNING **: gtkwidget.c:1489: container class
`gtkmm__GtkWindow' has no child property named `position'
core dump
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]