Toolbar with Multiple Rows

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
nashirak
Earned a small fee
Earned a small fee
Posts: 13
Joined: Fri Oct 08, 2004 12:24 pm

Toolbar with Multiple Rows

Post by nashirak » Mon Sep 26, 2005 2:38 pm

I think I am missing the concept on the SetRows method of wxToolbar. I get that if you do:
m_toolbar->SetRows(2);
that it will create a toolbar with 2 rows. What I am confused about is how I am supposed to add Control A to row 1 and Control B to row 2. I see no option in the AddControl to add a control to row 1 of the toolbar vs row 2. What am I missing? Thanks.

Using: wxWidgets 2.6.1
Platform: Windows XP

priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia » Mon Sep 26, 2005 3:17 pm


nashirak
Earned a small fee
Earned a small fee
Posts: 13
Joined: Fri Oct 08, 2004 12:24 pm

Post by nashirak » Mon Sep 26, 2005 3:33 pm

priyank_bolia wrote:Use wxCoolBar at:
http://www.planet-berlin-it.de/wx/wxcoolbar/

This is not an option as I must still maintain cross platform capability.

I know that SetRows() works for what I want it to do, I just need to understand how to specify which control goes in which row.

phlox81
wxWorld Domination!
wxWorld Domination!
Posts: 1387
Joined: Thu Aug 18, 2005 7:49 pm
Location: Germany
Contact:

Post by phlox81 » Mon Sep 26, 2005 4:13 pm

Hm, is there also a SetColumns Method ?
Then, you just have to fill it up with spacers probably.

wxToolBarBase isn't Documented...

nashirak
Earned a small fee
Earned a small fee
Posts: 13
Joined: Fri Oct 08, 2004 12:24 pm

Post by nashirak » Mon Sep 26, 2005 5:08 pm

phlox81 wrote:Hm, is there also a SetColumns Method ?


No there is no SetColumns method. There is a sample of the using the SetRows() code in: samples/toolbar/ but I cant figure out how they made sure the combobox goes up into the top toolbar other than magic. :) The only thing I can figure out is that it has something to do with sizing, but I am not sure, since as you said there is no documentation on this.
To anyone who has gotten multiple toolbars to work, is this the path you went down, or am I barking up the wrong tree.

frank_frl
Earned some good credits
Earned some good credits
Posts: 139
Joined: Sat Feb 18, 2006 1:41 pm
Location: Germany

Post by frank_frl » Sat Oct 28, 2006 11:54 am

Code: Select all

// the toolbar can wrap - limit the number of columns or rows it may take
    void SetMaxRowsCols(int rows, int cols)
        { m_maxRows = rows; m_maxCols = cols; }
    int GetMaxRows() const { return m_maxRows; }
    int GetMaxCols() const { return m_maxCols; }
Hi nashirak,

maybe those functions from wxToolBarBase will do what you want, never used it myself.

Frank

Mick P.
Earned some good credits
Earned some good credits
Posts: 110
Joined: Thu Jun 06, 2019 3:41 am
Contact:

Re: Toolbar with Multiple Rows

Post by Mick P. » Sun Sep 08, 2019 1:09 am

A little late, but on the subject of this I've added code to this (https://trac.wxwidgets.org/ticket/18143) to add wrapping to the wxMSM toolbar.

Code: Select all

if(1) if(wxToolBar*tb=wf.GetToolBar())
		{
			HWND hw = tb->GetHWND();
			SendMessage(hw,TB_SETSTYLE,0,
			SendMessage(hw,TB_GETSTYLE,0,0)|TBSTYLE_WRAPABLE);						
			tb->SetRows(SendMessage(hw,TB_GETROWS,0,0));
		}
SendMessage and RECT and Win32 constructs. You'd wrap this in #ifdef WIN32 blocks.

EDITED: This user-code is using wxWidgets 3.1.2. Since it's a workaround it is not guaranteed to work long term. It's also not portable, of course. BTW, I don't see how the mentioned Toolbar demo can work on wxMSW with today's implementation. SetRows changes the height, arbitrarily, but no toolbar elements will go onto the second row. This is a 14yo topic/thread, so things may have changed.

Post Reply