Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight NSView on Rollover/Click

Upon rolling over or clicking on an NSView, how can I update the view so that I can change the colour and other properties of view? It's the redrawing of the view which is the key to what I need to do, I already have a subclass created.

like image 645
Josh Kahane Avatar asked Jul 05 '11 21:07

Josh Kahane


1 Answers

Listen for mouse events and do appropriate actions inside them.

-(void)mouseEntered:(NSEvent *)theEvent {
    //draw rollover
}

-(void)mouseExited:(NSEvent *)theEvent {
    //draw normal
}

-(void)mouseDown:(NSEvent *)theEvent {
    //draw selected
}

-(void)mouseUp:(NSEvent *)theEvent {
    //draw normal
}
like image 138
sudo rm -rf Avatar answered Oct 14 '22 12:10

sudo rm -rf