• 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
custom NSButtonCell behaves different/wrong on Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

custom NSButtonCell behaves different/wrong on Leopard


  • Subject: custom NSButtonCell behaves different/wrong on Leopard
  • From: Mark Sanvitale <email@hidden>
  • Date: Tue, 15 Jul 2008 00:39:04 -0700

Summary of the problem is that I have a custom NSButton subclass which accomplishes a roll-over effect (title and background take on a special appearance when the mouse is over the cell). On Leopard, these same cells appear to perform a state change on mouse-over (the title and the image switch to their alternate state), but the state has not actually changed (according to gdb interrogation) and the title and image return to the normal state when the mouse leaves the cell/button.

Anyone seen this problem?  Anyone know what is/could-be going wrong?

The details:

My custom NSButtonCell subclass defines some new, custom methods, and it completely overrides drawBezelWithFrame, while it augments (i.e. still call through to super) the methods drawInteriorWithFrame, drawTitle, and drawImage. These cells appear in the window inside of a custom NSMatrix subclass which does the necessary mouse event handling to accomplish roll-over.

This all works fine and good on Tiger. On Leopard (with no code changes and the binary compiled on either Tiger or compiled against the 10.4 sdk on Leopard), the same button behaves wrong. The title and image being passed into the drawTitle and drawImage state are the alternates when the mouse is over the button, even though when I interrogate the cell in the debugger the state has not changed (still NSOffState, i.e. the normal, not alternate state). I can counteract the problem by ignoring the passed in title/image and determining it myself according to the current cell state, i.e.

image = ([self state] == NSOffState) ? [self image] : [self alternateImage];
title = ([self state] == NSOffState) ? [self attributedTitle] : [self attributedAlternateTitle];


however, one problem still persists (beyond the obvious confusion as to why such a tactic is even necessary) whereby the dimming of the image does not happen on mouse-down but, rather, happens on roll-over when the button is in the alternate state.

I'm at a loss.  Please help me.

Mark Sanvitale
Exbiblio
email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: custom NSButtonCell behaves different/wrong on Leopard
      • From: "Ken Ferry" <email@hidden>
  • Prev by Date: Re: KVV and the missing Discard Changes button
  • Next by Date: Re: Hillegass, Third Edition, Chapter 18
  • Previous by thread: Re: Hillegass, Third Edition, Chapter 18
  • Next by thread: Re: custom NSButtonCell behaves different/wrong on Leopard
  • Index(es):
    • Date
    • Thread