nsformatter

How do I use an NSFormatter subclass with an NSPopUpButton

I want to use an NSFormatter subclass to format the contents of an NSPopUpButton I'm using to display a list of choices. Basically I have an NSArray of MyObjects which is bound to the NSPopUpButton via the Content Values binding and I want to display something in the pop up menu other than what is returned by -description. I don't reall...

Two Digit Years with NSDateFormatter not working

I have a 10.4 style date formatter applied to an NSTextFieldCell. I call setTwoDigitStartDate: (tried with both the epoch date and the "reference" date) but when I type in a date with a two digit year it sets the year to 0009 instead of 2009. Header: IBOutlet NSTextFieldCell *transactionDateField; // outlet *IS* set correctly in IB I...

How to make a custom NSFormatter work correctly on Snow Leopard?

I have a custom NSFormatter attached to several NSTextFields who's only purpose is to uppercase the characters as they are typed into field. The entire code for my formatter is included below. The stringForObjectValue() and getObjectValue() implementations are no-ops and taken pretty much directly out of Apple's documentation. I'm usin...

Can a NSFormatter be used with a NSPopUpButton?

This question is similar to this one: http://stackoverflow.com/questions/821363/how-do-i-use-an-nsformatter-subclass-with-an-nspopupbutton As mentioned in that question, it seems like the 'formatter' used by the cell of a NSPopUpButton doesn't seem to work. I'm wondering if this is expected, or if there is actually a purpose to setting ...

How to get NSFormatter subclass to work with NSTableColumn sort key and selector?

My setup: I have a sqlite database from which I populate a NSMutableArray of NSDictionary objects this is the DataSource for my NSTableView. One of the columns holds "time", the time is a float that holds seconds. I would like to display the values in this column as minutes:seconds. For instance my data would be 123.4329387 I want t...

Make NSFormatter validate NSTextFieldCell continuously

In Cocoa, I have an NSOutlineView where the cells are NSTextFieldCell. The cell displays values which are strings that are formatted according to certain rules (such as floats or pairs of floats with a space in between). I have made a custom NSFormatter to validate the text, and this seems to work with no problem. However, the cell (or ...

Binding CoreData Managed Object to NSTextFieldCell subclass

I have an NSTableView which has its first column set to contain a custom NSTextFieldCell. My custom NSTextFieldCell needs to allow the user to edit a "desc" property within my Managed Object but to also display an "info" string that it contains (which is not editable). To achieve this, I followed this tutorial. In a nutshell, the tutoria...

How to set NSFormatter to accept negative integer values

The problem i have is when the formatter gets the string "-" or empty it fails to accept it. This makes entering a negative number a little bit uncomfortable. It also requires me to leave at least one digit in the field, which is also far from comfortable. Is there any way how a formatter would accept this as 0. My formatter works in N...

Use Multiple NSFormatters for the same NSTextfield

I have a textfield that I would like to use for multiple types of input. I have two custom NSFormatter classes that I would like to use for that field depending on what kind of input the user would like to provide. The input type is selected by a popup button before data is entered in the text field. I have an IBAction for the popup butt...