Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » ArrayCtrl cell color
Re: ArrayCtrl cell color [message #1082 is a reply to message #823] |
Sun, 19 February 2006 23:48 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
hojtsy wrote on Fri, 03 February 2006 09:28 | It could be PaintBackground. It is a good idea to call this method from the Display::Paint too, because then I only need to redefine the PaintBackground method and not the Paint for recoloring the background.
I was also thinking about how to completely remove the need for client-defined new classes just for the simple purpose of customizing the cell background/text color or font. The default Display could look something like this:void CellDisplay::Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword s) const
{
WString txt;
Font font = StdFont();
if(IsType<ArrayCell>(q))
{
ArrayCell ac(q);
txt = ac.txt;
if(!IsNull(ac.foreground)) ink = ac.foreground;
if(!IsNull(ac.background)) paper = ac.background;
if(!IsNull(ac.font)) font = ac.font;
}
else {
txt = IsString(q) ? q : StdConvert().Format(q);
}
PaintBackground(w, r, q, ink, paper, s);
int tcy = GetTLTextHeight(w, txt, StdFont());
DrawTLText(w, r.left, r.top + max((r.Height() - tcy) / 2, 0), r.Width(), txt, font, ink);
}
It's not that complicated or slow in the library and would really simplify the client code when colors/fonts are needed. The client would just use the ArrayCell value in the needed cells and immediately be able to assign colors for each cell withoth any subclassing. I understand that client code could also define this CellDisplay and ArrayCell class, but it seems a common need in many applications, so it could just be in the library.
|
Implemented as AttrText at StdDisplay level.
Mirek
|
|
|
|
|
ArrayCtrl cell color
By: hojtsy on Wed, 01 February 2006 16:29
|
|
|
Re: ArrayCtrl cell color
By: mirek on Wed, 01 February 2006 17:59
|
|
|
Re: ArrayCtrl cell color
By: hojtsy on Thu, 02 February 2006 16:51
|
|
|
Re: ArrayCtrl cell color
By: mirek on Thu, 02 February 2006 20:43
|
|
|
Re: ArrayCtrl cell color
By: hojtsy on Thu, 02 February 2006 21:46
|
|
|
Re: ArrayCtrl cell color
By: mirek on Thu, 02 February 2006 22:10
|
|
|
Re: ArrayCtrl cell color
By: hojtsy on Thu, 02 February 2006 22:46
|
|
|
Re: ArrayCtrl cell color
By: mirek on Thu, 02 February 2006 23:11
|
|
|
Re: ArrayCtrl cell color
By: hojtsy on Fri, 03 February 2006 00:06
|
|
|
Re: ArrayCtrl cell color
By: mirek on Fri, 03 February 2006 14:29
|
|
|
Re: ArrayCtrl cell color
By: hojtsy on Fri, 03 February 2006 15:28
|
|
|
Re: ArrayCtrl cell color
By: mirek on Fri, 03 February 2006 16:38
|
|
|
Re: ArrayCtrl cell color
By: hojtsy on Fri, 03 February 2006 16:48
|
|
|
Re: ArrayCtrl cell color
By: mirek on Fri, 03 February 2006 17:56
|
|
|
Re: ArrayCtrl cell color
By: fudadmin on Mon, 06 February 2006 06:20
|
|
|
Re: ArrayCtrl cell color
By: hojtsy on Tue, 07 February 2006 13:43
|
|
|
Re: ArrayCtrl cell color
By: forlano on Tue, 27 June 2006 20:13
|
|
|
Re: ArrayCtrl cell color
By: hojtsy on Tue, 27 June 2006 22:06
|
|
|
Re: ArrayCtrl cell color
By: forlano on Wed, 28 June 2006 00:49
|
|
|
Re: ArrayCtrl cell color
|
|
|
Re: ArrayCtrl cell color
By: mirek on Wed, 28 June 2006 14:13
|
|
|
Re: ArrayCtrl cell color
By: forlano on Wed, 28 June 2006 16:26
|
|
|
Re: ArrayCtrl cell color
|
|
|
Re: ArrayCtrl cell color
By: mirek on Sun, 19 February 2006 23:48
|
Goto Forum:
Current Time: Tue May 14 01:56:48 CEST 2024
Total time taken to generate the page: 0.02655 seconds
|