Toolbar tools are not showing on Windows Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

Toolbar tools are not showing on Windows

Post by fishnet37222 »

wxWidgets 3.1.0, Visual Studio 2017, Windows 10.

I am attempting to add a toolbar to a window. The toolbar gets added, but for some reason the tools are not showing. This only seems to happen on Windows. I am using XPM files for the toolbar button icons. I used the code below to set-up the toolbar. You can see from the screenshot that not even the text is showing.

Code: Select all

auto toolbar = this->CreateToolBar(wxTB_FLAT | wxTB_HORIZONTAL | wxTB_TEXT);
toolbar->SetToolBitmapSize(wxSize(16, 16));
toolbar->AddTool(wxID_ANY, "New Game", wxBitmap(new16), "Start a new game.");
2017-09-02_20-16-37.png
2017-09-02_20-16-37.png (2.23 KiB) Viewed 1291 times
Dave F.
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 437
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: Toolbar tools are not showing on Windows

Post by xaviou »

Hi.

I don't see any wxToolBar::Realize() call in your code.

You should call it after you've created the tools :

Code: Select all

auto toolbar = this->CreateToolBar(wxTB_FLAT | wxTB_HORIZONTAL | wxTB_TEXT);
toolbar->SetToolBitmapSize(wxSize(16, 16));
toolbar->AddTool(wxID_ANY, "New Game", wxBitmap(new16), "Start a new game.");
toolbar->Realize();
Regards
Xav'
My wxWidgets stuff web page : X@v's wxStuff
Post Reply