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: Setting column widths programmatically
Re: GridCtrl: Setting column widths programmatically [message #35435 is a reply to message #35434] Tue, 14 February 2012 05:12 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 527
Registered: March 2007
Contributor
Source code of test program in case you don't want to download it.
#include <CtrlLib/CtrlLib.h>
#include <GridCtrl/GridCtrl.h>


using namespace Upp;

class App: public TopWindow
{
public:
	App()
	{
		b.SetLabel("Random # of Columns").LeftPosZ(2, 250).TopPosZ(2,30);
		o.SetLabel("Proportional").LeftPosZ(260, 150).TopPosZ(2,30);
		o.SetData(true);
		grid.HSizePosZ(2,2).VSizePosZ(35,2);
		Add(b);
		Add(grid);
		Add(o);
		
		b<<=THISBACK(SetColumns);
		o<<=THISBACK(OptionClicked);
		SetColumns();
	}
private:
	void SetColumns()
	{
		dword c=::Random();
		c=5+c%4;
		grid.Clear(true);
		for(dword i=0; i<c; ++i)
		{
			grid.AddColumn(String().Cat()<<"Column "<<i, 50);
		}
	}
	
	void OptionClicked()
	{
		if(o.GetData()==true)
			grid.Proportional();
		else
			grid.Absolute();
	}

	Button b;
	Option o;
	
	GridCtrl grid;
	
	typedef App CLASSNAME;
};

GUI_APP_MAIN
{
		App().Title("Grid Column Width").Sizeable().Run();
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GridCtrl: Sorting order
Next Topic: GridCtrl: how to show the last inserted row
Goto Forum:
  


Current Time: Mon May 13 20:31:00 CEST 2024

Total time taken to generate the page: 0.03401 seconds