Re: [gtkmm] Notebook trouble



On Wed, 2004-03-17 at 08:11, Vladislav Grinchenko wrote:
> Daniel,
> 
> I have something similar implemented for one of my GUIs.
> TabWidget<> is the template class (attached).
> 
> You use it like this:
> class MainWindow 
> {
>    void on_close_tab_window ();
> 
>    ...
> 
>    Gtk::Notebook* m_notebook;
> };
> 
> MainWindow::MainWindow()
> {
>    ...
>    /** This tab should be a widget with [x] self-destruction button
>        in it. When clicked, it should wipe out this table and remove
>        the tab.
>     */
>    irina::TabWidget<MainWindow>* tabw;
>    tabw = manage (new irina::TabWidget<MainWindow> (*this, tbl_name_));
>    m_notebook->prepend_page (*table, *tabw);
>    m_notebook->set_current_page (m_notebook->page_num (*table));
> 
>    ...
> }
> 
> And the callback:
> 
> void
> MainWindow::
> on_close_tab_window ()
> {   
>     /** Close current tab and release data structure.
>      */
> 
>      int n = m_notebook->get_current_page ();
>      CfgStatTbl* table = dynamic_cast<CfgStatTbl*> (m_notebook->get_nth_page(n));
>      m_notebook->remove_page (n);
> 
>      ...
>      delete table;
> }
> 

I can't see how this closes a tab other than the current one.  Say a
user has 5 tabs open, and the 5th tab is the current tab.  If the user
clicks the close button on say the 2nd tab without bringing that tab to
focus, will the second page be removed, or will the current (5th page)
page be removed?  I don't understand how this would not just close the
current page.

Thanks for the response and the header file,
Dan




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