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 |
|
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
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
|
It's in uvs now Get it and try it. It should work (it was not tested)
|
|
|
Goto Forum:
Current Time: Sun May 12 10:09:22 CEST 2024
Total time taken to generate the page: 0.01468 seconds
|