Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 next 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.
Re: Only one additional argument for Bar callback? [message #20859 is a reply to message #20823] Tue, 14 April 2009 22:29 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
THISBACK2 is widely used, see e.g.:

void Ide::InsertMenu(Bar& bar)

so it must be either something else or something very specific.

What is the error?

Mirek
Previous Topic: right-click menu
Next Topic: ToolBar enabling and disabling question
Goto Forum:
  


Current Time: Fri Apr 19 18:52:10 CEST 2024

Total time taken to generate the page: 0.03857 seconds