• 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
Formatters, editing events and NSMatrix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Formatters, editing events and NSMatrix


  • Subject: Formatters, editing events and NSMatrix
  • From: Andrew White <email@hidden>
  • Date: Fri, 05 Nov 2004 13:03:58 +1100

I have an NSMatrix containing 6 NSTextFields. I want to apply a single formatter to all elements of the field, and also catch textDidEndEditing events for any element (at which point I recalcaluate a large array).

I did consider using bindings rather than respond to textDidEndEditing, but as far as I can tell I'd have to set up a separate rule for each line of my array (all lines are independent), whereas by catching an event I can use array indexing, saving a lot of code.


What I've done:

In IB: created an NSNumberFormatter in the nib, and attached it to the 'formatter' outlet of the NSMatrix.

In the NSDocument subclass:

- (void) makeWindowControllers
{
	MyWindowController * ctl =
		[ [MyWindowController alloc]
			initWithWindowNibName: [self windowNibName]
		];
	[ctl autorelease ];
	[self addWindowController: ctl ];
}

In MyWindowController, override textDidEndEditing.

In IB: Set type of FilesOwner to MyWindowController.
In IB: Set delegate of NSMatrix to File's Owner.

However, no formatting is done on entries, and the textDidEndEditing method is not called. Obviously I'm doing both these things wrongly.

What is the correct way to do this?


I note that each NSTextFieldCell has it's own formatter. I certainly don't want to set these manually in IB, though I'm willing to do it programmatically on window load if I have to.


I can't find a delegate field in the NSTextFieldCells in IB, so I don't know if I can attach the delegate directly to the cells, even if I wanted to.


Thanks

--
Andrew White
_______________________________________________
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: Formatters, editing events and NSMatrix
      • From: "Jonathan E. Jackel" <email@hidden>
  • Prev by Date: Re: Internationalization: How to bring the locale in line with the language?
  • Next by Date: memory management (perhaps naive) question
  • Previous by thread: Formatter, delegate for NSMatrix with NSTextFields
  • Next by thread: RE: Formatters, editing events and NSMatrix
  • Index(es):
    • Date
    • Thread