Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » how align a column?
Re: how align a column? [message #5397 is a reply to message #5394] |
Mon, 18 September 2006 14:26   |
 |
mirek
Messages: 14261 Registered: November 2005
|
Ultimate Member |
|
|
nicomesas wrote on Mon, 18 September 2006 08:16 | Hey
I have a ArrayCtrl in which a column represents money and I build it thus:
theList.AddColumn("donativo").SetFormat("%2!nl").HeaderTab().SetAlign(ALIGN_RIGHT);
The numerical columns see far better if they are aligned to right.
Nevertheless the alignment only affects to the header, not to the data in the column.

I believe that it must be possible that all a column is aligned, but encounter the function or the method not to do it.
Somebody can give an instructions to me.
Nico
|
Using Display.
In my commercial apps, I am using this one:
class DisplayMoney : public Display {
public:
void Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const;
protected:
Font font;
bool red;
public:
static DisplayMoney Normal;
static DisplayMoney Bold;
static DisplayMoney NormalRed;
DisplayMoney& SetFont(Font _font) { font = _font; return *this; }
DisplayMoney& Red(bool b) { red = b; return *this; }
DisplayMoney& NoRed() { return Red(false); }
DisplayMoney(Font font = GuiFont(), bool red = true) : font(font), red(red) {}
};
void DisplayMoney::Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword s) const {
String text;
if(!IsNull(q)) text = FormatMoney(q);
int cx = GetSmartTextSize(w, text, font).cx;
w.DrawRect(r, paper);
DrawSmartText(w, r.left + r.Width() - cx, r.top, r.Width(), text, font,
double(q) < 0 ? (s & CURSOR) && (s & FOCUS) ? SLtRed: SRed : ink);
}
You can achieve pretty much any appearance using Display. To use it, make instance that outlives ArrayCtrl (static variable is enough) and assign it to the ArrayCtrl columns using SetDisplay.
|
|
|
 |
|
how align a column?
By: nicomesas on Mon, 18 September 2006 14:16
|
 |
|
Re: how align a column?
By: zsolt on Mon, 18 September 2006 14:26
|
 |
|
Re: how align a column?
By: mirek on Mon, 18 September 2006 14:26
|
 |
|
Re: how align a column?
By: nicomesas on Mon, 18 September 2006 15:06
|
 |
|
Re: how align a column?
By: kfeng on Thu, 12 July 2007 21:21
|
 |
|
Re: how align a column?
By: mirek on Thu, 12 July 2007 21:59
|
 |
|
Re: how align a column?
By: kfeng on Thu, 12 July 2007 23:54
|
 |
|
Re: how align a column?
By: mirek on Fri, 13 July 2007 00:55
|
 |
|
Re: how align a column?
By: kfeng on Sat, 14 July 2007 09:36
|
 |
|
Re: how align a column?
By: mirek on Mon, 16 July 2007 23:53
|
Goto Forum:
Current Time: Tue Jun 24 12:45:22 CEST 2025
Total time taken to generate the page: 0.03905 seconds
|