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 #18589 is a reply to message #18588] Fri, 10 October 2008 16:15 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
You can set the display for individual cells in an ArrayCtrl with
	void            SetDisplay(int i, int col, const Display& d);

then you just have to iterate through the columns to set each cell on a row.

And an easier way of getting colored displays:
template <const int COLOR>
class ColorDisplayTemplate : public Display
{
	virtual void Paint(Draw& w, const Rect& r, const Value& q,
			Color ink, Color paper, dword style) const
			{ StdDisplay().Paint(w, r, q, ink, Color::FromRaw(COLOR), style); }
};

const Display &RedDisplay() 	{ return Single< ColorDisplayTemplate<RGB(255, 0, 0)> >(); }
const Display &BlueDisplay() 	{ return Single< ColorDisplayTemplate<RGB(0, 0, 255)> >(); }
const Display &GreenDisplay() 	{ return Single< ColorDisplayTemplate<RGB(0, 255, 0)> >(); }


A template? Is not it a bit brutal? Smile

What about a nice little Color attribute (and perhaps global variables instead of Single)?

Mirek

[Updated on: Sat, 11 October 2008 00:10] by Moderator

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 Apr 29 16:16:35 CEST 2024

Total time taken to generate the page: 0.02785 seconds