FROM : Fred Glover
DATE : Thu Dec 09 01:44:10 2004
I am successfully binding NSTextViews to my model data path with the
Value With Pattern - DisplayPatternValue1 method in IB.
However, for the life of me I can't make printf type format statements
work.
For instance, I have a fairly narrow NSTextField but it's easily wide
enough for 10 characters.
When I use the Display Pattern
Pct: %@
I get the display I want when then exact value (float) from my bound
data path is 100 or 62.5 or 0 (only a few digits).
Pct: 0 or Pct:100 or Pct: 62.5
When it's a repeating decimal (e.g. 33.33333333) only Pct: gets
displayed in the NSTextField, without any number, I suppose because the
long decimal can't all be displayed.
I've tried all sorts of formatting characters in various places in the
Display Pattern box. So far I haven't hit on the secret combination of
format characters and locations in the box.
Ideally I'd like it formatted something like 33.33%. And no, it's not
possible to round my model data to the desired number of decimal places
or digits.
Do I need a custom formatter?
Fred
Fred Glover
Machine Vision and Image Processing Engineering
Visicon Inc
www.visiconeng.com
Los Gatos, CA
408 354-0095
DATE : Thu Dec 09 01:44:10 2004
I am successfully binding NSTextViews to my model data path with the
Value With Pattern - DisplayPatternValue1 method in IB.
However, for the life of me I can't make printf type format statements
work.
For instance, I have a fairly narrow NSTextField but it's easily wide
enough for 10 characters.
When I use the Display Pattern
Pct: %@
I get the display I want when then exact value (float) from my bound
data path is 100 or 62.5 or 0 (only a few digits).
Pct: 0 or Pct:100 or Pct: 62.5
When it's a repeating decimal (e.g. 33.33333333) only Pct: gets
displayed in the NSTextField, without any number, I suppose because the
long decimal can't all be displayed.
I've tried all sorts of formatting characters in various places in the
Display Pattern box. So far I haven't hit on the secret combination of
format characters and locations in the box.
Ideally I'd like it formatted something like 33.33%. And no, it's not
possible to round my model data to the desired number of decimal places
or digits.
Do I need a custom formatter?
Fred
Fred Glover
Machine Vision and Image Processing Engineering
Visicon Inc
www.visiconeng.com
Los Gatos, CA
408 354-0095
| Related mails | Author | Date |
|---|---|---|
| Fred Glover | Dec 9, 01:44 | |
| mmalcolm crawford | Dec 9, 02:09 |






Cocoa mail archive

