NSMenuItem with CustomView - strange behavior
NSMenuItem with CustomView - strange behavior
- Subject: NSMenuItem with CustomView - strange behavior
- From: Peter Krajcik <email@hidden>
- Date: Sun, 7 Jun 2009 22:22:16 +0200
Hello,
I ma trying to mimic a grey color look of menus like in Apple Pro Apps.
I found a way how to change a background color of menu (top and bootom
caps) and using custom View
in NSMenuItem I can do what I need in NSView in a place of NSMenuItem
(background, text, image).
I am using this menu with NSPopButton and there are two problems I
can't figure out:
1. when I open menu in NSPopUpButton, menu closes on MouseUp event in
a parent window -> Should on MouseDown (actually, menu is recieving
cancelTracking on MouseUp, but should on MouseDown). If I set this
NSPopUpButton to [self setPullsDown:YES] it works (Menu closes at
MouseDown)
2. I am highliting my NSViews checking for [[self enclosingMenuItem]
isHighlighted]. The problem is that when menu is open for the first
time, and let's say, menu item 1 with my NSView is highlighted, it
doesn't recieve -(void)drawRect:(NSRect) rect message whn mouse moves
to enother item. So, it stays highlighted. When I move mouse back to
this item 1, and then to another item, item now recieves -
(void)drawRect:(NSRect) rect message and unhighlighte itself.
The first problem is present also in Apple sample (MenuItemView).
Does anybody know a workaround ?
Thank you.
Peter
_______________________________________________
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