Re: Newbie -- Notification Help
Re: Newbie -- Notification Help
- Subject: Re: Newbie -- Notification Help
- From: Itrat Khan <email@hidden>
- Date: Sun, 17 Mar 2002 14:24:55 -0500
On Saturday, March 16, 2002, at 09:40 PM, Lucas Haley wrote:
I was just wondering if anyone could point me in the right direction
-- how would one go about setting up two NSTextFields in one window,
so that as the user types into NSTextField "A", the same text appears
in NSTextField "B"? I suspect it is pretty easy, but I'm shaky on the
whole notification thing.
It is pretty easy.
In Interface Builder:
1. Connect the delegate of NSTextField "A" to your controller
2. Connect the outlets from your controller to the text fields (i.e.
textFieldAOutlet)
In your controller:
1. Implement controlTextDidChange: (see NSControl documentation) as:
- (void)controlTextDidChange:(NSNotification*)aNotification
{
// test if the sender is text field A (optional)
if ([aNotification object] == self->textFieldAOutlet)
{
[[self->textFieldBOutlet cell]
takeObjectValueFrom:[self->textFieldAOutlet cell]];
}
}
Regards,
Itrat.
..................................................................
Itrat Khan
Modeless Software, Inc.
http://www.modeless.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.