Re: Building menu's lazily
Re: Building menu's lazily
- Subject: Re: Building menu's lazily
- From: Tobias Klüpfel <email@hidden>
- Date: Tue, 26 Aug 2003 14:23:25 +0200
Hi Hsu,
On Dienstag, 26. August 2003, at 11:47AM, Alastair J.Houghton wrote:
On Tuesday, August 26, 2003, at 09:16 am, Hsu wrote:
Is there a way (Carbon or Cocoa) to build up a menu lazily?
Take a look at the ADC-TV samples.
Also have a look at the API description for the NSMenu delegate methods.
menuNeedsUpdate: would be called just before your menu would be
displayed, so you could defer populating your menu until then. You
would, however also have to implement the methods numberOfItemsInMenu:
and menuHasKeyEquivalent: forEvent: target:action:, because the
Application wouldn't know about things like key shortcuts and suchlike
at the time your menu had not been populated yet.
My advice is to have a background thread generate the menu, unless the
user clicks on a menu item, which would force you to block execution to
generate the menu.
HTH
Toby
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.