Button with a "mouseover" alternate image?
Button with a "mouseover" alternate image?
- Subject: Button with a "mouseover" alternate image?
- From: "Theodore H. Smith" <email@hidden>
- Date: Sun, 15 Jan 2006 20:49:09 +0000
I'm trying to get an NSbutton, to have something like an
"alternateImage", except that it is a "mouseOverImage".
So this image will be displayed instead of the normal image, when the
mouse is over.
Any ideas how this is done?
The only way I can think of is a really clunky hack that is probably
5x more complex than it should be, because I don't know the Cocoa
framework all that well.
I was thinking of just overriding [display] and maybe any other
methods being called. Maybe just alter my NSButton's "image" property
from within the [display] method, according to which method is
calling me. I'd have to set a state variable in the NSButton's
properties to see who is calling it.
So if I got a mouseOver method, I'd then do this:
self->MySubClassesSpecialState = kMouseOver;
[super mouseOver];
[self display];
In display, I'd do this:
if (MySubClassesSpecialState == kMouseOver) {
[self setImage : SomeImage];
[super display];
[self setImage : OldImage];
}
Clunky, but it might work.
Although it might not work as I haven't tested it.
Any better ideas anyone?
Also, btw does anyone know how to get an NSView which accepts NSDrag
stuff, to display a blue outline inside itself, during the drag
operation? I can't figure it out.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden