I’m creating several menu items programmatically like this :
NSMenuItem* newItem = [[NSMenuItem alloc] initWithTitle:t action:s keyEquivalent:e];
[newItem setTarget:target];
[newItem setEnabled:YES];
[self addItem:newItem];
And I want to truncate their contents (in the middle) like that :
Some really really long title —> Some rea…title
I’ve read about using the setLineBreakMode method… but HOW? (I think I’m doing something wrong :-S)
A possible solution consists to use NSAttributedString and the [NSMenuDelegate confinementRectForMenu:onScreen:screen];
confinementRectForMenu is necessary to set the max width you want
Just to show you an example without delegate below I show a menuitem with a very big font