Accessing children on Gtk::Notebook



Dear GTKMM users,

I am trying to understand the Gtk::Notebook widget for a project that I am
currently writing.

The main problem I have is that I want to be able to add my widgets to the
Notebook dynamically, meaning I do not know what object will got on tab 1
and tab 2, hence need to keep a reference to the GTK obejcts somehow.


So as an example:  

1). New notebook tab is created
2). a Vbox is created
3). a label (or similar) is add are added to that VBOX based 
4). a VBox container is appended to the notebook current tab

at some point, and several new tabs later I want to be able to go to ie.
page 2 in the Notebook and list the childeren on that page.

In this case it should give me only the VBOX. This can again be examined for
children, and then I would get a Label which I can then point to to change
the text.

If this is not the right approach please feel free to educate me, and point
me in the right direction.

I would prefer a solution with a Gtk::Mange rather than the new/delete. I
read that GTKMM has a helper function for gtk::notebook, but it do what I
want?  
-If yes will someone be so kind to snow me how it could be done:

here a small snippet of how the code could look like, I would like to change
the "on_button_modifyTabContent()" so i can change the text in the label
which got added by "on_button_createNewTab()"

void exampleWindow::on_button_createNewTab()
{
    Gtk::Label *pLabel;
    pLabel = manage( new Gtk::Label("New Tab/Label") );
    
    m_Notebook.pages().push_back(
        Gtk::Notebook_Helpers::TabElem(*pLabel, "Tab x") );

    m_Notebook.show_all();
    m_Notebook.set_current_page(-1);
}

void exampleWindow::on_button_modifyTabContent()
{
    // I want to access the "elements" on the notebook.page. But how do I do
that?
    //Gtk::Widget* pTest =
m_Notebook.get_nth_page(m_Notebook.get_current_page());

    .....
}


Thanks in advance for any help!
.Daniel

ps. And yes, i am not an experienced c++ programmer ;-)
-- 
View this message in context: http://old.nabble.com/Accessing-children-on-Gtk%3A%3ANotebook-tp33207725p33207725.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]