force NSTextField to be KVC compliant? possible?

Discussion in 'Mac Programming' started by dj.mooky, Jun 19, 2009.

  1. dj.mooky macrumors newbie

    Feb 26, 2008
    I've got an issue where I would severely love to control the stringValue of a textfield by calling them with strings. I have read over the documentation now, and as far as I can read, I am doing things correctly...


    #interface data : NSObject {
    IBOutlet NSTextField *txtField1;
    -(void)setTxtField1:(NSString *) aString;
    -(NSString *) txtField;
    In both of the methods here I've got the code functioning to properly use a string value that is passed or returned, this much I have checked...

    My issue comes down to this part... in my controller.m I've got an instance of data as myData, attempting something like this

    [myData setValue:@"a value" forKey:@"txtField"];
    I cannot figure out a way to get the textField to actually change its data taht it is showing to the screen..

    I would prefer to do it this way, because I want to take the large amount of textfield's in data.h, and write one function that I can pass variables to that will correctly adjust the visible information.

    Any thoughts / suggestions / other ways of doing this, would be greatly appreciated...

Share This Page