wxNotebook tabs without close button, tabs larger

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

wxNotebook tabs without close button, tabs larger

Post by p_lu »

Can somebody help me with creating tabs that have no close button (permanent) and
also tabs resized to be bigger (say 3x default)? I'm using wxNotebook via Codeblocks
IDE with wxSmith to do the layout. Is wxNotebook the right widget to use?

Thanks for any and all help.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxNotebook tabs without close button, tabs larger

Post by ONEEYEMAN »

Hi,
What do you mean by "tabs without close button"?
Can you show some screenshot?

Thank you.
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxNotebook tabs without close button, tabs larger

Post by p_lu »

Please see attachment. The "x" after the active tab (Summary) is the close button,
which will close the tab.

I'd also want to change the Summary and Setup tabs (themselves) to take up more
real-estate, since the user input selection is a small touch-screen, making it
tough to see or touch-select (with the current small size).

Thanks.
wxNotebookTabs.JPG
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxNotebook tabs without close button, tabs larger

Post by p_lu »

I think there may be a wxNotebook/wxwidgets bug, since there is a
wxAUI_CLOSE_ON_ACTIVE_TAB Style attribute, and regardless of whether
it's checked on or off, the "x" remains on the active tab. The
wxAUI_CLOSE_ON_ALL_TABS attribute, however, seems to do the
right thing since it being checked on enables the "x" on all tabs.

Anyone know how to fix these things (in the code?)? I'm using wxWidgets
3.0.4.
wxNotebookTabBug.JPG
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxNotebook tabs without close button, tabs larger

Post by p_lu »

Looks like if I uncheck the wxAUI_NB_DEFAULT_STYLE attribute, then the
wxAUI_CLOSE_ON_ACTIVE_TAB attribute takes effect. So, problem 1 solved.

Problem 2: How to make the tabs larger?

Thanks.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxNotebook tabs without close button, tabs larger

Post by PB »

Firstly, you are talking about wxAuiNotebook, not wxNotebook which is a different class - I suppose you checked out the bundled aui demo?

Secondly, you did not define "larger". Larger font, or taller and/or wider without regard to the font used etc?

I have little experience with AUI but it would seem logical that you should try (not ideally documented) wxAuiTabArt methods related to sizing. But it is possible that you would need to derive a new wxAuiTabArt class, which may not be tbat simple, considering there are several of them in use depending on the platform and programmer choice...
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxNotebook tabs without close button, tabs larger

Post by p_lu »

Sorry. Fairly new to this wxWidgets stuff and don't know all the classes and toolkits
around. If there is a wxNotebook (as opposed to wxAuiNotebook) that would do
what I need, please let me know.

I'm not familiar with the Aui demo and will look for it. Thanks.

As for the wxAuiNotebook tabs being larger, I just want the tab keys (themselves)
generally occupying more space (say 3x taller, with 3x larger fonts [since widths
are maxed out when wxAUI_NB_TAB_FIXED_WIDTH Style attribute is checked on]).
This is so the tabs can be seen more easily and touch-selected easily using a
finger on a touch screen.

I'll look into wxAuiTabArt, but this will probably be over my head for the moment,
with what little I know.

Thanks.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxNotebook tabs without close button, tabs larger

Post by ONEEYEMAN »

Hi,
First of all - you title contradicts your problem. In the title you are asking about notebook without close button, whereas in reality you want one.

Second - you are talking about wxAuiNotebook, which means that you already found the class that you need. If you want the wxNotebook - they don't have a closing "x" on the tabs. So you need to decide which one you want. You can also check the documentation online - it has a screenshots of all controls available and there you can see what control will look like on screen.

Third - you should really look into compiling both auidemo and notebook samples. They are provided to you by the library. There you can see what both controls will look like and play with them. They demonstrate a ot of different features and they can give you an idea what each control is capable of. As you can probably guess, auidemo will demonstrate the capability of wxAuiNotebook and notebook sample will demonstrate wxNotebook one. Compile them, run them, play with them. Decide which one you want.

It would also be great if you can try those samples on the target device(s) and see how they both behaves.

Let us know if you need anything more.

Thank you.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxNotebook tabs without close button, tabs larger

Post by PB »

AUI demo is in WXWIN/samples/aui

wxWidgets have online documention, for wxAuiNotebook in wxWidgets 3.1 it is here
https://docs.wxwidgets.org/3.1/classwx_ ... ebook.html

Just skimming the docs linked from above, you can see that there are methods with promising names/descriptions, such as
SetTabCtrlHeight() or Set***Font()...
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxNotebook tabs without close button, tabs larger

Post by p_lu »

For problem 1, by what I wrote previously:

> Looks like if I uncheck the wxAUI_NB_DEFAULT_STYLE attribute, then the
> wxAUI_CLOSE_ON_ACTIVE_TAB attribute takes effect.

the "take effect" means if wxAUI_NB_CLOSE_ON_ACTIVE_TAB is unchecked,
then the "x" button disappears, which is what I want/need and agrees with
the topic title. By default, wxAuiNotebook has close-on-active-tab enabled
when wxAUI_NB_DEFAULT_STYLE is checked, ignoring the setting of
wxAUI_CLOSE_ON_ACTIVE_TAB, which was why I thought there was a bug.

As for problem 2, it's resolved too. I had changed the font size (say 2x
default) of the notebook and saw no change in the wxSmith layout or
preview, so assumed that was not the right setting (thinking it only affected
text size somewhere in the notebook rather than in the tab label itself).
A closer look at the notebook documentation indicated that the font size is
indeed the tab label's font size. Looking at the generated code a little
more, I realized that I needed to build and run the layout to see any result.
Voila, indeed the tab label font size changed in the way I want/need; the
wxSmith layout and preview don't reflect the running result.

Thanks.
Post Reply