If you use text drawing, your first click will be slow. That's the penalty of 
loading each font.

That's why -- at least internally -- the menu code caches the image of each 
item, so that the second and subsequent displays of the menu will be quick.

You really have two solutions -- pre-image each menu item (and it can be done 
and maintain the transparency -- draw the text to an image and a mask, then 
combine the two), or reduce the number of items in the popup menu. Also, just 
because you're using an image for the menu item doesn't mean that you can't set 
the title of the item.

On Aug 28, 2011, at 11:25 PM, Rimas M. wrote:

> Well.. that worked. Generally. But those images must have transparent 
> background. And as I have discovered, when dealing with text drawing, that 
> causes loose of sub-pixels antialiasing. This is unacceptable. Will need to 
> use NSAttributedString+attributedTitle way... Any hints on speeding up menu 
> showing time on the first click?
> 
> Regards,
> 
> Rimas M.
> 
> On Thu, Aug 4, 2011 at 12:07 PM, Rimas M. <apple.list...@gmail.com> wrote:
> Drawing item titles into image and caching them for later use works nice. But 
> I have noticed unacceptable side effect. Normally, when menu is displayed you 
> can press any letter key, and menu will scroll to the first item, which title 
> starts with that letter. In my case , NSMenuItems does not have titles and 
> that does not work. Looking for workaround to maintain this functionality.
> 

_______________________________________________

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 arch...@mail-archive.com

Reply via email to