how to allow controller to know when nsslider has mouse over it
hey guys, I'm trying to figure out a way for my controller to activate a function when my custom slider has a mouse over it.
My slider can change to a highlighted color when mouse is over, that was easy cause I just had to change the image drawn on the slider. However besides that, I would like to be able to do more with it, like unhide an image if it's not a mouse over, and hide on mouse exit. Different sliders will activate different images.
The way I'm loo开发者_运维百科king at it, my approach is as follows.
1) I could tag the sliders so that the controller will know which image to unhide and hide.2) On mouse over, my controller will be informed, and then the controller will hide or unhide the picture. I can't hardcode this into the nsslider class as the slider is used app wide, and I believe if I did hardcode it, then any slider that I have my mouse over will hide or unhide the image.
Any ideas as to what approach I should take?
Thanks guys.
NSSlider is an NSControl, which is an NSView, which can have one or more NSTrackingArea objects defined. Add / manage it with NSView's -addTrackingArea: (and related) method.
精彩评论