Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
UPDATE: Every time I post here I seem to find the answer shortly after. I was looking for the tag in the Notification data when I should have been searching the TextField data. I found it. Sorry!

I have a number of NSTextFields and have given them tags in IB. When I select and change the data in a NSTextField this delegate method is called successfully

Code:
- (void)controlTextDidChange:(NSNotification *)notification {
    NSTextField *textField  = (NSTextField *)[notification object];
    NSLog(@"controlTextDidChange: stringValue == %@", [textField stringValue]);
    sendValue = [[textField stringValue]intValue];
}
When I examine the information of the notification there is no tag information?

Printing description of notification:

NSConcreteNotification 0x6080000498d0 {name = NSControlTextDidChangeNotification; object = <NSTextField: 0x600000184850>; userInfo = {

NSFieldEditor = "<NSTextView: 0x610000121360>\n Frame = {{2.00, 3.00}, {29.00, 17.00}}, Bounds = {{0.00, 0.00}, {29.00, 17.00}}\n Horizontally resizable: YES, Vertically resizable: YES\n MinSize = {29.00, 17.00}, MaxSize = {40000.00, 40000.00}\n";

}}

I have not implemented any tag code yet since I can't seem to gain access to it? I have about 28 textFields and I need to know which one is selected. I need to use it in this type of code
Code:
[myArray objectAtIndex:[textField tag]];

This seemed easier in IOS then OS X?
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.