Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » how align a column?
Re: how align a column? [message #10532 is a reply to message #10507] |
Sat, 14 July 2007 09:36   |
kfeng
Messages: 18 Registered: July 2007 Location: Tokyo, Japan
|
Promising Member |
|
|
luzr wrote on Fri, 13 July 2007 00:55 |
kfeng wrote on Thu, 12 July 2007 17:54 |
Another question: is there a standard format for displaying %d or %f like this:
$58,782,398.23
with commas?
|
No.
Quote: |
If not, maybe you can guide me to where I can add code for this feature with any suggestions on the protocol. If you do, I can code it up and submit it for addition to the code base.
|
But you in fact do not need to fix uppsrc code to get it: Format is extensible, you can add your own formatters quite easily, see RegisterFormatter (it is even documented .
In the same time, would be nice to have it in Core too later, but for that purpose it would best be done configurable via translations... (means it should be described by some string literal, just like date or time).
Mirek
|
Hi Mirek,
Internationalization is a little beyond me for now, so I will just submit a little snipplet for others to use/incorporate into their code:
String CommaFormatter(const Formatting& f)
{
int commaSpacing = 3; // fix at 3 for now
String res = Format( "%" + f.format + "f", f.arg ); // replace our format with "f"
int period = res.Find( '.' );
int idx = (period<0) ? res.GetLength() : period;
while( (idx-=commaSpacing)>0 )
res.Insert( idx, ',' );
return res;
}
// Test it
RegisterNumberFormatter("C", CommaFormatter);
String test = Format( "%.2C", 35829123.4253 );
// 35,829,123.43
- Ken
|
|
|
 |
|
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: Wed Jun 25 02:30:07 CEST 2025
Total time taken to generate the page: 0.03938 seconds
|