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 » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl: Adding column dynamically – How to make editable
Re: GridCtrl: Adding column dynamically – How to make editable [message #23374 is a reply to message #23370] Wed, 14 October 2009 19:23 Go to previous messageGo to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Vector should be replaced by Array.

class definition:
class DynGridTest : public WithDynGridTestLayout<TopWindow> {
public:
	typedef DynGridTest CLASSNAME;
	DynGridTest();
	void Prepare();
	Array<EditString> vs; // <-- Must be in class definition
};


main.cpp:
DynGridTest::DynGridTest()
{
	CtrlLayout(*this, "Grid Dynamic Column Add Test");

}
void DynGridTest::Prepare() {
	vs.Clear();
	for(int i = 0; i < 10; i++) {
		grd.AddColumn("col"+AsString(i)).Editable(true).Edit(vs.Add());
	}
	for(int i = 0; i < 10; i++) {
		grd.Add();
		for(int j = 0; j < 10; j++) {
			grd(j) = "x="+AsString(j)+"; y="+AsString(i);
		}
	}
	grd.SetToolBar();
}

GUI_APP_MAIN
{
	DynGridTest app;
	app.Prepare();
	app.Run();
}


This example works fine.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Inheriting from DropGrid
Next Topic: DoSum(), DoAvg(), etc... and search operations
Goto Forum:
  


Current Time: Sun Jul 06 17:32:00 CEST 2025

Total time taken to generate the page: 0.03505 seconds