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 and AttrText
Re: GridCtrl and AttrText [message #9060 is a reply to message #9058] Sun, 15 April 2007 23:48 Go to previous messageGo to previous message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

forlano wrote on Sun, 15 April 2007 15:56


Sorry, but I've not understood your recipe.


That's ok. I should have desctibed it better Smile
Quote:


I used the following code to color the cell of a column and it works
class ColoredStatus : public GridDisplay
{ public:
    void Paint(Draw &w, int x, int y, int cx, int cy, const Value &val, dword style,
				           Color &fg, Color &bg, Font &fnt, bool found, int fs, int fe);
	
};

void ColoredStatus::Paint(Draw &w, int x, int y, int cx, int cy, const Value &val, dword style,
				           Color &fg, Color &bg, Font &fnt, bool found, int fs, int fe)
{
    if( StrInt(AsString(val)) >= 2451 )	bg = Color(0, 255, 0);	
    GridDisplay::Paint(w, x, y, cx, cy, val, style, fg, bg, fnt, found, fs, fe);
} 

But now I would like to apply it to others columns, each with its own color. So I would pass to the previous class a parameter and then by a switch select the right color.


There is a col variable accesible in GridDisplay class that you can use to deterimine painted column
void ColoredStatus::Paint(Draw &w, int x, int y, int cx, int cy, const Value &val, dword style,
				           Color &fg, Color &bg, Font &fnt, bool found, int fs, int fe)
{
    if( StrInt(AsString(val)) >= 2451 )	bg = Color(0, 255, 0);	
    if(col == 0) bg = Red;
    if(col == 1) bg = Yellow;
    GridDisplay::Paint(w, x, y, cx, cy, val, style, fg, bg, fnt, found, fs, fe);
} 

Quote:


or maybe wait until AttrText is operative Smile


It's in uvs now Smile Get it and try it. It should work (it was not tested) Wink
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GridCtrl and mingw compiler error
Next Topic: SqlArray: mouse selection
Goto Forum:
  


Current Time: Sun May 12 10:09:22 CEST 2024

Total time taken to generate the page: 0.01468 seconds