I'm new to xcode/cocoa and objective-c programming and was looking for a onMouseHover event for my application. I've looked through the documentation and it doesn't seem to have one.
How do I go about programming this?
I've created a subclass of NSView but don't know where to go from there.
Is there a way to add a mouse event using Interface builder just like how an 'action' or 'outlet' can be instantly added?
Also, do all actions execute on a leftmouseclick event? Is there a way to override this?
How do I go about programming this?
I've created a subclass of NSView but don't know where to go from there.
Code:
subClass.h
#import <Cocoa/Cocoa.h>
@interface subClass : NSView
{
}
- (void)mouseMoved:(NSEvent*)theEvent;
@end
Code:
subClass.m
#import "subClass.h"
@implementation subClass
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
}
return self;
}
- (void)mouseMoved:(NSEvent*)theEvent {
[text setStringValue:@"mouse moved"];
}
@end
Is there a way to add a mouse event using Interface builder just like how an 'action' or 'outlet' can be instantly added?
Also, do all actions execute on a leftmouseclick event? Is there a way to override this?