Re: Best practices for using standard window widgets in a custom window
Re: Best practices for using standard window widgets in a custom window
- Subject: Re: Best practices for using standard window widgets in a custom window
- From: Jens Alfke <email@hidden>
- Date: Wed, 20 Jan 2010 20:56:00 -0800
On Jan 20, 2010, at 9:43 AM, Kevin Wojniak wrote:
> NSWindow's standardWindowButton:forStyleMask: method works great for creating these buttons and adding to my custom (frame) view. However, the mouse over effect does not work without using undocumented methods. Mainly, overriding _mouseInGroup: in the button's superview (frame view) and returning YES when the mouse is over the buttons. This works, and I notice Google Chrome uses the same method, but I really dislike using undocumented APIs like this, especially for UI work.
Funny you should point this out. I just found out the hard way that the code currently used in Chromium has some issues — it crashes on 'textured' windows for some reason. (Not currently a problem as Chromium has no textured windows, but I tried adding one the other day, and blammo.) So I wouldn't recommend anyone copy-and-paste it into their own project. Unfortunately it was the best solution the Chromium developers could come up with at the time … if anyone knows a better approach, we'd love to know.
(In Chromium's case, the window does use the standard frame, but moves the buttons down 3 pixels to better center them against the tabs.)
—Jens_______________________________________________
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