Reputation: 1
I want to have mouse hover on NSSegmentControl with menu items, I know i need to do something in this.
- (void)mouseDown:(NSEvent *)event
{
}
please guide me , as i am noobs to mac os development.
Upvotes: 0
Views: 93
Reputation: 71
You need to activate mouseMove events. One way is by adding tracking rects:
- (void)updateTrackingAreas {
[super updateTrackingAreas];
[self addTrackingArea:[[NSTrackingArea alloc] initWithRect:self.frame options:NSTrackingActiveAlways | NSTrackingInVisibleRect | NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved owner:self userInfo:nil]];
}
- (void)mouseEntered:(NSEvent *)theEvent {
[self updateMenu];
}
- (void)mouseExited:(NSEvent *)theEvent {
[self updateMenu];
}
- (void)mouseMoved:(NSEvent *)theEvent {
[self updateMenu];
}
But the UI doesn’t look like a mac app. If it really needs to look like this, maybe you are better off building it in HTML and embed an WebKitView??
Upvotes: 1