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 samples with all functions and methods
Re: GridCtrl samples with all functions and methods [message #26019 is a reply to message #26018] Fri, 26 March 2010 11:05 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3372
Registered: August 2008
Senior Veteran
Hello Ficko

This will work.

I have just moved EditString name; and EditInt age; out of App() and added grid.Editing().Appending().AskRemove().Canceling().Duplicati ng().Clipboard().ColorRows(); . You will not need it all but it is just a sample. Try to click with right button Smile

Hope this helps.

#include <GridCtrl/GridCtrl.h>

using namespace Upp;

struct App : TopWindow
{
	typedef App CLASSNAME;
	
	GridCtrl grid;
	
	EditString name; // Out of App() so they are always available
	EditInt age;
			
	App()
	{
		Add(grid.SizePos());
		grid.AddColumn("Name").Edit(name); //This dosn't work
		grid.AddColumn("Age").Edit(age);//Or I am missing a callback not explained in help
		grid.Add("Ann", 21)
		.Add("Jack", 34)
		.Add("David", 15);
		grid.Editing().Appending().AskRemove().Canceling().Duplicating().Clipboard().ColorRows();   // With this you can edit, append, ...
		grid.WhenLeftDouble = THISBACK(ShowInfo); //This works
		//grid.WhenRowChange = THISBACK(RandomColor); //This dosn't compile
	}
	void ShowInfo()
	{
		PromptOK(Format("%s is %d years old", grid(0), grid(1)));
	}
	void RandomColor()
	{
		grid.GetRow().Bg(Color(rand() % 255, rand() % 255, rand() % 255));
	}
};


GUI_APP_MAIN
{
	App().Run();
}


Best regards
IƱaki
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem - GridCtrl::Get(int,int) with DropTree
Next Topic: Copy GridCtrl cell when read only
Goto Forum:
  


Current Time: Sun Jun 02 10:07:45 CEST 2024

Total time taken to generate the page: 0.02694 seconds