How can I make an NSComboBox disappear when an NSTextField is clicked? This is the code I'm using:
Class comboBox: (used as custom class for my NSComboBox in the interface builder) comboBox.h:
#import <Cocoa/Cocoa.h>
@interface comboBox1 : NSComboBox
-(void)Hide;
@end
comboBox.m:
#import "comboBox1.h"
@implementation comboBox1
-(void)Hide
{
[self setHidden:YES];
}
@end
Class txtField: (used as custom class for my NSTextField in the interface builder) txtField.h:
#import <Cocoa/Cocoa.h>
@interface txtField1 : NSTextField
@end
txtField.m:
#import "txtField1.h"
#import "comboBox1.h"
@implementation txtField1
-(void)mouseDown:(NSEvent *)theEvent
{
comboBox1 *obj = [[comboBox1 alloc] init];
[obj Hide];
}
@end
But it doesn't work: when click the TextField nothing happens. Thank you in advice.