Hi Mark, Could you file a bug with a test app please?
There are basically two reasons for a button to display alternate content. (1) The cell's state is not NSOffState and the showsStateBy mask contains NSContentsCellMask. (2) The cell is highlighted and the highlightsBy mask contains NSContentsCellMask. The 'button types' you see in IB (and in -[NSButtonCell setButtonType:]) correspond to different configurations of the showsStateBy and highlightsBy masks. A 'momentary change' button has NSContentsCellMask set in its highlightsBy mask and a 'toggle' button has NSContentsCellMask in its showsStateBy mask. -Ken On Tue, Jul 15, 2008 at 12:39 AM, Mark Sanvitale <[EMAIL PROTECTED]> wrote: > 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 PROTECTED] > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com > > This email sent to [EMAIL PROTECTED] > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]