• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Value With Pattern formatting with Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Value With Pattern formatting with Bindings


  • Subject: Value With Pattern formatting with Bindings
  • From: Fred Glover <email@hidden>
  • Date: Wed, 8 Dec 2004 16:44:10 -0800

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: %{value1}@

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

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Value With Pattern formatting with Bindings
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Auto-hiding and auto-showing an NSTextField border
  • Next by Date: Re: Value With Pattern formatting with Bindings
  • Previous by thread: Re: Help with runtime warning
  • Next by thread: Re: Value With Pattern formatting with Bindings
  • Index(es):
    • Date
    • Thread