Creating delegates for formatters/text fields
Creating delegates for formatters/text fields
- Subject: Creating delegates for formatters/text fields
- From: Mark Dawson <email@hidden>
- Date: Wed, 15 Dec 2004 10:31:35 -0800
I'm trying to understand the concept of how to create & use delegates
for controls. I've created a custom formatter, and want to put up
error dialogs. I know I need to create a delegate
control:didFailToFormatString and didFailToValidatePartialString. My
question revolves around WHERE to put the delegate. I assume that you
put it in the same controller that the text you will be validating
(app, window, etc) is. One piece of sample code I've found checks to
see if if (control == [self textField]) to make sure that we're
operating on the correct field.
So if I understand things correctly, every time I add my custom
formatter (and associated error dialog delegate) to a text field, I
have to:
(1) Add that text field as an outlet in that controller's .h file
(2) In IB, connect it up
(3) In IB connect up as a delegate that controller
(4) Add (if not already there) didFailToFormatString &
didFailToValidatePartialString
methods to that controller
(5) Inside those two methods, use name of the text field (as described
in the outlet definition in (1)) as a check to make sure it's getting
called from the correct place
I have to run in 10.2, so I (don't think) I can use bindings, if that
changes anything…
Thanks!
mark
_______________________________________________
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