How to change the colour and size of the border between tabs in wxAuiNotebook Topic is solved

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
User avatar
DebugBSD
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Apr 30, 2020 6:15 am
Location: Madrid, Spain

How to change the colour and size of the border between tabs in wxAuiNotebook

Post by DebugBSD » Fri Jun 05, 2020 3:58 pm

Hi, good afternoon.

I'm trying to change the default colour of the border between tabs in a wxAuiNotebook and after long hours of research and trying every thing I found on Google, I don't know where to go or how to change it. The thing is I have this Application (See screenshot) and I would like to change the colour and the thickness. Any idea about how to do that?

I show you the code of my constructor:

MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, "Caronte Editor", wxDefaultPosition, wxSize(1191, 777), wxNO_BORDER | wxCLIP_CHILDREN),

Next is the default art provider to change the background colour and active colour of the wxAuiNotebook tabs:

m_pArtProvider->SetColour(g_backgroundColor);
m_pArtProvider->SetActiveColour(g_activeTabColor);

Next I show you how I have created the tabs:

wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer(wxHORIZONTAL);

m_auinotebook5 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE |
wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER);
m_auinotebook5->SetArtProvider(m_pArtProvider);
m_panel17 = new wxPanel(m_auinotebook5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_panel17->SetForegroundColour(*wxWHITE);
m_auinotebook5->AddPage(m_panel17, wxT("a page"), false, wxNullBitmap);
m_panel18 = new wxPanel(m_auinotebook5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_auinotebook5->AddPage(m_panel18, wxT("a page"), false, wxNullBitmap);
m_panel19 = new wxPanel(m_auinotebook5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_auinotebook5->AddPage(m_panel19, wxT("a page"), false, wxNullBitmap);
m_panel20 = new wxPanel(m_auinotebook5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_auinotebook5->AddPage(m_panel20, wxT("a page"), true, wxNullBitmap);
m_panel21 = new wxPanel(m_auinotebook5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_auinotebook5->AddPage(m_panel21, wxT("a page"), false, wxNullBitmap);
m_panel22 = new wxPanel(m_auinotebook5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_auinotebook5->AddPage(m_panel22, wxT("a page"), false, wxNullBitmap);
m_panel23 = new wxPanel(m_auinotebook5, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_auinotebook5->AddPage(m_panel23, wxT("a page"), false, wxNullBitmap);

bSizer2->Add(m_auinotebook5, 1, wxEXPAND | wxALL, 5);

Thank you so much for everything!
Have a nice day
Guille
Attachments
MainFrame.png
MainFrame.png (15.02 KiB) Viewed 401 times
Happy Hacking

User avatar
doublemax
Moderator
Moderator
Posts: 15280
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to change the colour and size of the border between tabs in wxAuiNotebook

Post by doublemax » Fri Jun 05, 2020 4:33 pm

I'm not sure, but maybe the wxAuiDockArt provider is responsible for these.
https://docs.wxwidgets.org/trunk/classw ... k_art.html

Try setting wxAUI_DOCKART_PANE_BORDER_SIZE and wxAUI_DOCKART_BORDER_COLOUR.
Use the source, Luke!

User avatar
DebugBSD
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Apr 30, 2020 6:15 am
Location: Madrid, Spain

Re: How to change the colour and size of the border between tabs in wxAuiNotebook

Post by DebugBSD » Fri Jun 05, 2020 5:19 pm

Hi doublemax, thank you so much for your answer!

I have tested both flags and some others more (wxAUI_DOCKART_SASH_COLOUR, wxAUI_DOCKART_BORDER_COLOUR and xAUI_DOCKART_GRIPPER_COLOUR) but none of them have worked. I tried to change the thickness of the border with the flag (wxAUI_DOCKART_PANE_BORDER_SIZE ) but it didn't work. I don't know if it's my problem or it's something more, but I paste the code I have tried:

This is the constructor:
MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, "Caronte Editor", wxDefaultPosition, wxSize(1191, 777), wxNO_BORDER | wxCLIP_CHILDREN),
m_IsDragging { false },
m_IsResizing { false },
m_pArtProvider{ new CEArtProvider() }
{
mgr.SetManagedWindow(this);
mgr.GetArtProvider()->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE, 1);
mgr.GetArtProvider()->SetColour(wxAUI_DOCKART_BACKGROUND_COLOUR, *wxRED);
mgr.GetArtProvider()->SetColour(wxAUI_DOCKART_SASH_COLOUR, *wxGREEN);
mgr.Update();

m_pArtProvider->SetColour(g_backgroundColor);
m_pArtProvider->SetActiveColour(g_activeTabColor);

...
Happy Hacking

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

Re: How to change the colour and size of the border between tabs in wxAuiNotebook

Post by ONEEYEMAN » Fri Jun 05, 2020 6:14 pm

Hi,
Could you try to create a new art provider and use it in new code?

Maybe those settings should be set along with something else?

Thank you.

User avatar
doublemax
Moderator
Moderator
Posts: 15280
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to change the colour and size of the border between tabs in wxAuiNotebook

Post by doublemax » Fri Jun 05, 2020 6:18 pm

It seems that wxAuiNotebook has its own internal wxAuiManager.

I managed to change the color using this const_cast hack:

Code: Select all

   wxAuiManager &mgr = const_cast <wxAuiManager &> (notebook->GetAuiManager());
   mgr.GetArtProvider()->SetMetric(wxAUI_DOCKART_SASH_SIZE, 5);
   mgr.GetArtProvider()->SetColour(wxAUI_DOCKART_SASH_COLOUR, *wxYELLOW);
Use the source, Luke!

User avatar
DebugBSD
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Apr 30, 2020 6:15 am
Location: Madrid, Spain

Re: How to change the colour and size of the border between tabs in wxAuiNotebook

Post by DebugBSD » Sat Jun 06, 2020 3:20 pm

doublemax wrote:
Fri Jun 05, 2020 6:18 pm
It seems that wxAuiNotebook has its own internal wxAuiManager.

I managed to change the color using this const_cast hack:

Code: Select all

   wxAuiManager &mgr = const_cast <wxAuiManager &> (notebook->GetAuiManager());
   mgr.GetArtProvider()->SetMetric(wxAUI_DOCKART_SASH_SIZE, 5);
   mgr.GetArtProvider()->SetColour(wxAUI_DOCKART_SASH_COLOUR, *wxYELLOW);
Hi doublemax,

Definitively, that solved my problem. I don't know how to thank you. After three days trying everything I was thinking to implement a Docking System from scratch.

Thank you so much!
Guille
Happy Hacking

Post Reply