View Full Version : Same textField from two different classes
Streamer
May 1, 2008, 08:52 PM
Apols for a noobie question. I have a textfield and it is connected as an outlet to one class, however I sometimes want to write to it from another class. I ended up declaring an outlet in the new class and connecting that, so I have the same object as two outlets. Is that ok or am I heading to a bigger problem.
Thanks.
HiRez
May 1, 2008, 11:19 PM
You can reference it from as many classes as you like. Another way would be to have a controller object that has sole direct access to it and then access it from other classes through the controller, like [[myController testTextField] setStringValue:@"TEST"];
Streamer
May 2, 2008, 07:39 AM
Many thanks for the answer. I did originally try the latter way but I think I screwed up my bracket ordering :cool:
Much appreciated.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.