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 » How to Setup ArrayCtrl colors ?
Re: How to Setup ArrayCtrl colors ? [message #18579 is a reply to message #18578] Fri, 10 October 2008 12:41 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1226
Registered: August 2007
Senior Contributor
Quote:


i want to set a color and then add a row with this color then change it and add another row with another color ......how can i do that ?



You can use Display structure and SetDisplay() method to set column colors and content:

First you should add a Display object. For example:
struct Column1Display : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
	{
		w.DrawRect(r, Color(500,0,0));
	}
};

struct Column2Display : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
	{
		w.DrawRect(r, Color(0,500,0));
	}
};



Then, Set the Display of the column, using ArrayCtrl::Column::SetDisplay() or Array::SetDisplay() in your constructor or wherever you instantiate your ArrayCtrl object:

MyApp::MyApp()
{
//.....
//.....

MyArray.AddColumn("Column 1").SetDisplay(Single<Column1Display>());
MyArray.AddColumn("Column 2").SetDisplay(Single<Column2Display>());

}


This will set the "column 1" and "column 2" colors. You can set other columns' displays as such. As you may have noticed, by using the Display structure you can also do other specific operations on a single column (eg, adding images, changing background, fonts, etc.). Display also has a virtual PaintBackground() method which you can set background seperately See Display structure for more information.

Regards.


[Updated on: Fri, 10 October 2008 13:08]

Report message to a moderator

 
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
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
Read Message
Previous Topic: Spanning Columns?
Next Topic: Cells appearance and text alignment
Goto Forum:
  


Current Time: Mon Aug 25 12:52:06 CEST 2025

Total time taken to generate the page: 0.03890 seconds