• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Button with a "mouseover" alternate image?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Button with a "mouseover" alternate image?
      • From: Chad Weider <email@hidden>
  • Prev by Date: Parsing iTunes XML to NSTableView
  • Next by Date: Re: Endian-ness of "PkgInfo" file
  • Previous by thread: Re: Parsing iTunes XML to NSTableView
  • Next by thread: Re: Button with a "mouseover" alternate image?
  • Index(es):
    • Date
    • Thread