cocoa - LSUIElement behaves inconsistently with activateIgnoringOtherApps -
Specifically, this text behaves incompatible with field focus.
I have an LSUIElement, picking up a status menu. There is a view in the menu that has a text field. The text field should be selectable - must not be selected by default, but whatever.
When the status item is clicked, it triggers
[ignoring NSAP activationOtherApps: yes];
And it works for about half an hour. * The other half position menu is considered "in the background" and I do not even notice the text field, click on it (I know that the status item is firing to click-trigger / NSLog on it).
Does the apple handle things in these situations or is I'm activating Ignoring? Other exploration?
* In fact, it seems that after the activation of any other app only fail for the first time. After that it works fine.
Full snippet:
- Display the popup menu associated with the status (i.e.) sender {// status item} (zero) status. [StatusPopupStatusItemMenu: statusMenu]; // Activate * after showing the popup menu to get the focus for the text area. [NSAP activation blocking other ads: Yes]; }
Finally came up with an alternative solution for this.
Instead of popping up menus in your click handler, activate the app and then schedule an NSTimer that has no delay which pops up the menu:
- (zero) Pop: (NSTimer *) timer {[statusItem popUpStatusItemMenu: Menu]; } - (zero) status itemclaimed: sender {[other applications blocked by NSAP activation: yes]; [NSTM Scheduled timer with time: 0.0 targets: Self selector: @sillector (pop :) user ink: zero repeats: no]; }
pop:
is called on the next frame so that the delay is invisible, but is long enough to activate: Other Express:
Anything that was stopped by doing the job as expected while popping the menu in the same frame.
Comments
Post a Comment