Re: An Octal number into a Textfield
Re: An Octal number into a Textfield
- Subject: Re: An Octal number into a Textfield
- From: Sherm Pendley <email@hidden>
- Date: Tue, 13 Jun 2006 11:15:05 -0400
On Jun 13, 2006, at 8:55 AM, Andrew Knott wrote:
Hi everyone,
Just a quick one... I'm trying to get an NSTextField to display an
octal number
If I have :
fileMode = 0644;
and set a textField with
[octalField setStringValue: [[NSNumber
numberWithUnsignedLong:fileMode] stringValue]];
I get only the decimal version of the number? How would I get an
octal representation? With a NSNumberFormatter perhaps? I don't
seem to be able to find any hints...
You could use the "%o" format with sprintf(), or NSString's -
stringWithFormat: to get the octal representation.
If you're using bindings your textField, or even just assigning a new
value pretty often, a formatter is the way to go. But, you'll need to
use the above suggestions in a subclass NSFormatter or
NSNumberFormatter. As far as I know, neither one handles octal by
default.
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
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