Moving wxAuiToolbar 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
miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Moving wxAuiToolbar

Post by miclus » Tue Mar 09, 2010 1:29 am

Hi, I created a wxAuiToolbar and put a gripper on it. But, I can't get it to drag any where left or right. I added it to a box sizer and was thinking it would move left or right in it.

JimFairway
wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Post by JimFairway » Tue Mar 09, 2010 1:56 am

Hi,

Why did you put in a sizer?
Did you look at the sample in wx/Samples/aui?

Jim
OS: Vista SP1, wxWidgets 2.8.7.

miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Post by miclus » Tue Mar 09, 2010 2:02 am

Well, my whole app is built around the sizers and whatnot. I was just looking to change my wxToolbar to a moveable one. Is there a way to make it moveable without using that manager thing? If not, can I somehow embed the manager among the other items in the sizer?

miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Post by miclus » Tue Mar 09, 2010 2:04 am

One other thing I noticed is in some examples the gripper is shown with wxAUI_TB_DEFAULT_STYLE, but not for mine. I have to explicitly give it the gripper flag.

miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Post by miclus » Sun Apr 04, 2010 5:58 am

Ok, without transforming my whole frame, is there a way I can embed some type of item into a small space to allow me to move the toolbar in that space?

miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Post by miclus » Sun Apr 04, 2010 8:49 pm

Ok, I figured it out. But, I have a question. If I have a notebook control, how could I put a managed toolbar just below the tabs instead of above?

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif » Sun Apr 04, 2010 11:21 pm

the only way to do this is to add the toolbar to the added page itself.

Another option, is to create your own class a container class which has a toolbar and make your actual page its child.

Something like this:

Code: Select all

class ContainerWithToolBar : public wxPanel
{
	wxToolBar *m_tb;
public:
	ContainerWithToolBar(wxWindow *parent, wxWindowID id = wxID_ANY)
	: wxPanel(parent, id)
	{
		CreateGuiControls();
	}
	
	void CreateGuiControls()
	{
		wxBoxSizer *box = new wxBoxSizer(wxVERTICAL);
		SetSizer(box);
		
		// Create and set the toolbar
		m_tb = new wxToolBar(this, wxID_ANY);
		box->Add(m_tb, 0, wxEXPAND);
		
		// Add tools here
		// ...
		
		m_tb->Realize();
		GetSizer()->Layout();
	}
	
	void SetWindow(wxWindow *win)
	{
		win->Reparent(this);
		GetSizer()->Add(win, 1, wxEXPAND);
		GetSizer()->Layout();
	}
}

// to add pages to the notebook:

// Allocate container 
ContainerWithToolBar *container = new ContainerWithToolBar(theNotebook);

// Allocate the page itself, make it a child of the container
MyPage *page = new MyPage(container);

// Add it to the container
container->SetWindow( page );

// Add the container to the notebook
theNotebook->AddPage(container, wxT("Tab One"), true);

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Post by miclus » Sun Apr 04, 2010 11:30 pm

Thanks, I think I figured it all out by trial and error.

miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Post by miclus » Mon Apr 05, 2010 12:54 am

Ok, one more thing. I notice on the aui manager, when I click on toggle buttons on toolbars, they don't update until I move the mouse off of the toolbar. Is there a way to make them update immediately?

I should say, it's for any type of changing icon. I have to move the mouse away from the icon, then the toolbar refreshes to the new icon.

Post Reply