cocoa - NSMenu doesn't start tracking -


I have a little cocoa app that usually operates in the background (as an agent). Sometimes I want to be able to pop up a context menu (at this time there is no window or visible).

As soon as I'm targeting Snow Leopard, I tried to: / P>

  if (windows) {nsmainu = emmenu = [[[NSNAN ALLOCK] INST Vitalical: @ "Test"] AutoWrecks]; [Menu satoshostat column: no]; [Menu setautoanables item: no]; (In the id items window) {NSString * labelText = @ "some text"; NSMenuItem * theMenuItem = [[[NSMenuItem alloc] initWithTitle: LabelTest Action: @Selector (menu item selected) Key: @ ""] AutoWaves]; [Manual set target: self]; [MANUITUM SETELECTED object: ITEMS]; [Manitim set enabled: Yes]; [Damage set image: icon]; [Damenu ed etaem: Damenu Itam]; } [Menu popup menuupposing item: location on zero: [NSEC mouse movements] invoice: nil]; }  

The menu popup is completely but if I hover the item with the mouse cursor, they do not highlight and I can not click them.

Menu item selected: The method looks like this:

  - (IBAction) MenuIntermitted: (ID) sender {}  

Even thoughts which I am doing wrong?

I suspect that the windowing system does not consider activating your app, and therefore does not send mouse events to you In the menu.

As an experiment, try creating a dummy window before popping up the menu I can create a NSPanel , possibly the style NSNonActivatingPanelMask . makeKeyAndOrderFront: Pop up your window / panel, then the menu and see what happens.

If this works, I want to stay with the view and hide the window.


Comments