Re: [gtkmm] Confused with TabElem



On Sat, 2004-03-13 at 02:51, Andreas B. Thun wrote:
> 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

Thanks for the response, Andreas.

This works for me too.  However, I have an interesting complication to
closing tabs.  I have added "close buttons" to each tab (similar to
gedit).  In the close button callback, if I use the get_current_page(),
the current page showing gets closed no matter which tab close-button is
clicked.  I need a way to bring the tab to focus when the close button
is clicked.  I think I could do this by calling the same callback for
the switch-page signal that the tabs are receiving.  Could I do this by
finding the code in the gtk/gtkmm source itself, and copying it to my
button callback?  This sounds both messy and difficult since I have no
clue what the Gtk source looks like. 

My other idea was to use the page_num() function using the button itself
as the widget to look for.  I was actually going to try this before
trying to find the switch-page callback in the Gtk source.  Hopefully it
will work. :)

Any thoughts?

Thanks,
Dan

P.S.  Just want to thank Murray and all of the developers at Gtkmm.org. 
Gtkmm has  made my transition into Linux GUI programming (from a
computer sciences student with little GUI experience) easy and fun. 
Keep up the good  work!




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