U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » Menus&Toolbars » Only one additional argument for Bar callback?
Only one additional argument for Bar callback? [message #20823] Fri, 10 April 2009 19:15 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

As it was stated in U++ docs, I may post additional argument to a function creating a toolbar:
	void OnUpdateGraphToolbar(GraphProjectUI &ui, bool newTabSelected)
	{
		ui.toolsGraphs.Clear();
		ui.toolsGraphs.Set(callback1(this, &GraphProject::SetToolsGraphs, &ui));
	}

	void SetToolsGraphs(Bar &b, GraphProjectUI *ui)
	{
		gecs.InstallToDropCtrl(ui->colls);
		b.Add(ui->colls, 100, ui->colls.GetStdSize().cy);
		b.Add(!ui->colls.GetData().IsNull(), GraphEditorImg::graph_add, callback(this, &GraphProject::Dummy));
		b.ToolGapRight();
		b.Separator();
		b.Add(false, GraphEditorImg::graph_remove, callback(this, &GraphProject::Dummy));
	}


But when I try to post two additional arguments:
	void OnUpdateGraphToolbar(GraphProjectUI &ui, bool newTabSelected)
	{
		ui.toolsGraphs.Clear();
		ui.toolsGraphs.Set(callback2(this, &GraphProject::SetToolsGraphs, &ui, newTabSelected));
	}

	void SetToolsGraphs(Bar &b, GraphProjectUI *ui, bool newTabSelected)
	{
		if (newTabSelected)
			gecs.InstallToDropCtrl(ui->colls);
		b.Add(ui->colls, 100, ui->colls.GetStdSize().cy);
		b.Add(!ui->colls.GetData().IsNull(), GraphEditorImg::graph_add, callback(this, &GraphProject::Dummy));
		b.ToolGapRight();
		b.Separator();
		b.Add(false, GraphEditorImg::graph_remove, callback(this, &GraphProject::Dummy));
	}

-- it fails to compile!

I may of course work around this, but IMO it is a U++ bug.
 
Read Message
Read Message
Previous Topic: right-click menu
Next Topic: ToolBar enabling and disabling question
Goto Forum:
  


Current Time: Tue Sep 15 10:39:10 GMT+2 2026

Total time taken to generate the page: 0.00596 seconds