wx.Notebook button alongside tabs

106 views
Skip to first unread message

John Lane

unread,
May 15, 2017, 12:32:00 PM5/15/17
to wx-users
I'm using the notebook as the main interface for a small application and
I would like to add a discrete button at the right-hand end of the tab
bar off which I can hang a menu. Think the "hamburger" menu many
websites have these days.

I have a subclass of wx.Notebook where I would like to add this. I'm not
sure how to go about it so would appreciate any pointers or examples
that can set me off along the right path...

In case it make any difference, I'm targeting GTK, MSW and MacOS.

Thanks,
John

Vadim Zeitlin

unread,
May 15, 2017, 12:43:05 PM5/15/17
to wx-u...@googlegroups.com
On Mon, 15 May 2017 17:31:32 +0100 John Lane wrote:

JL> I'm using the notebook as the main interface for a small application and
JL> I would like to add a discrete button at the right-hand end of the tab
JL> bar off which I can hang a menu. Think the "hamburger" menu many
JL> websites have these days.
JL>
JL> I have a subclass of wx.Notebook where I would like to add this. I'm not
JL> sure how to go about it so would appreciate any pointers or examples
JL> that can set me off along the right path...

The simplest would probably switch to using wxAuiNotebook which supports
this out of the box, see the (C++) aui sample. The native wxNotebook
control does not support this and there is no simple way to do it with it,
unfortunately.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

John Lane

unread,
May 15, 2017, 2:35:24 PM5/15/17
to wx-u...@googlegroups.com
On 15/05/17 17:43, Vadim Zeitlin wrote:

>
> The simplest would probably switch to using wxAuiNotebook which supports
> this out of the box, see the (C++) aui sample.

Thank you, that was the pointer I needed. I very quickly changed my code
and now have wxAuiNotebook running. I am still trying to work out how to
add a button but I have seen the style "wx.aui.AUI_NB_CLOSE_BUTTON"
which adds a tab-close button exactly where I want my button.

I'm having difficulty locating the C++ sample that does this but still
looking...

Igor Korot

unread,
May 15, 2017, 2:54:03 PM5/15/17
to wx-u...@googlegroups.com
Hi, John,
It will be in the wxWidgets/samples/auidemo.cpp

Thank you.

>
> --
> Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
>
> To unsubscribe, send email to wx-users+u...@googlegroups.com
> or visit http://groups.google.com/group/wx-users
Reply all
Reply to author
Forward
0 new messages