wxToolBar:: SetToolSeparation() doesn't work

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
Eng3
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Jan 14, 2018 8:02 am

wxToolBar:: SetToolSeparation() doesn't work

Post by Eng3 »

Hey guys, I'm working with wxWidgets 3.0.3 and wxSmith on Code::Blocks. I added a wxToolBar and a separator with wxSmith and tried to manually change the size of the separator since the Toolbar Editor provided by wxSmith couldn't define the size of it. However, wxToolBar:: SetToolSeparation() didn't work at all, and the separator was always the default size, which was 5 I believe. Anybody knows how to make it work?
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxToolBar:: SetToolSeparation() doesn't work

Post by eranon »

It has no effect here (in Windows 7 against wx 3.01) too. Despite the code below, the separation remains unchanged on screen.

Code: Select all

ToolBar1->SetToolSeparation(200);
So, maybe it's a limitation of the underlying native toolbar OR because it's not implemented in wxMSW.

Looking quickly at code, I see that there's only one implementation of wxToolBar::SetToolSeparation in "src/gtk1/toolbar.cpp" and in the base class (tbarbase.h|cpp), I just see it assigns the new passed value to m_toolSeparation... So the next step would be to check where this member variable is in-use for real; maybe during Realize().

--
EDIT: In my C::B's wxSmith (svn 10895, an old version), I can indicate the separation size (there's a field in the toolbar properties and it well writes down the SetToolSeparation() line in code for you.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Eng3
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Jan 14, 2018 8:02 am

Re: wxToolBar:: SetToolSeparation() doesn't work

Post by Eng3 »

I have tried it already, it's not working for me unfortunately
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxToolBar:: SetToolSeparation() doesn't work

Post by eranon »

However, if it's important for you, you can always dig and see against native toolbar if there's a way or not... For Windows, you can play with TB_SETPADDING (see https://msdn.microsoft.com/en-us/librar ... s.85).aspx).
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Eng3
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Jan 14, 2018 8:02 am

Re: wxToolBar:: SetToolSeparation() doesn't work

Post by Eng3 »

Thank you very much for the help. I will start looking into the native toolbar documentation
Post Reply