Re: highlighting menu item in main menu bar
Re: highlighting menu item in main menu bar
- Subject: Re: highlighting menu item in main menu bar
- From: Peter Ammon <email@hidden>
- Date: Mon, 1 Jun 2009 11:10:18 -0700
Hi Ken,
The menu item unhighlights after the menu item's action is finished.
If user input should be blocked while the script is running, then you
should register for the NSTaskDidTerminateNotification and then drive
the main run loop forwards from within your menu item's action method,
until you get the notification.
On the other hand, if the user can continue using your app as normal,
you should not show the menu item highlighted, because the user might
want to choose different menu items.
On Jun 1, 2009, at 9:34 AM, email@hidden wrote:
my app has a scripts menu item (in the main menu bar). the items in
this menu correspond to applescript files the user has placed in my
application support folder. when the user selects one of these menu
items, i execute the appropriate script. i execute the script in a
(sub) task (NSTask). i do it this way because i discovered (the hard/
empirical way) that if an executing script, executes functionality
in my app that calls -[NSScriptCommand suspendExecution], then the
executing of that script will erroneously terminate early. using a
sub task solves this problem.
in my app, when i launch this task, i register for the
NSTaskDidTerminateNotification and in my notification routine, i
display any errors returned.
this all works fine... except that as soon as i return from
launching the sub task, the menu item (in the main menu bar) for the
scripts menu un-highlights. i would like this to remain highlighted
until my notification routine is called, in order to provide
feedback to the user that his/her script is still executing.
is this possible? if so, could someone provide any code and/or
documentation pointers?
thanx,
ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden