Re: Global Access Controls ?
Re: Global Access Controls ?
- Subject: Re: Global Access Controls ?
- From: Andreas Schempp <email@hidden>
- Date: Fri, 25 Apr 2003 10:10:37 +0200
Von: Andreas Schempp <email@hidden>
Datum: Fre, 25. Apr 2003 10:10:00 Europe/Zurich
An: Greg Hulands <email@hidden>
Betreff: Re: Global Access Controls ?
I think you should use a delegate method
/* MyClass */
#import <Cocoa/Cocoa.h>
@interface MyClass : NSObject
{
IBOutlet NSTextField *txtName;
}
-(void)awakeFromNib
{
[MyClass2 setDelegate:self];
}
-(void)setTextField:(NSString *)stringValue
{
[txtName setStringValue:@"Helllo"];
}
@end
/* MyClass2 */
#import <Cocoa/Cocoa.h>
@interface MyClass2 : NSObject
{
id _delegate;
}
-(void)setDelegate:(id)delegate
{
_delegate = delegate;
}
-(id)delegate
{
return _delegate;
}
-(void)awakeFromNib
{
[[self delegate] setTextField:@"Helllo"];
}
@end
But this would only work if you load MyClass2 from MyClass...
Useful for multiple nibs!
On Friday, April 25, 2003, at 10:06 AM, Chad Eckles wrote:
Hello I have a control that i want to define only onece and i want to
be
able to use it in other classes without having to redefine it over an
over
an over again how can i do this ?
E.g
I have MyClass with a Defined NSTextField and in MyClass2 i want to be
able
to access that NSTextField with out having to redefine it ?
/* MyClass */
#import <Cocoa/Cocoa.h>
@interface MyClass : NSObject
{
IBOutlet NSTextField *txtName;
}
@end
/* MyClass2 */
#import <Cocoa/Cocoa.h>
@interface MyClass2 : NSObject
{
}
-(void)awakeFromNib
{
[txtName setStringValue:@"Helllo"];
}
@end
_______________________________________________
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.
_______________________________________________
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.