Re: How to intercept NSToolbar item selection changes
Re: How to intercept NSToolbar item selection changes
- Subject: Re: How to intercept NSToolbar item selection changes
- From: Michael Ash <email@hidden>
- Date: Mon, 9 Mar 2009 12:57:18 -0400
On Mon, Mar 9, 2009 at 12:38 PM, Stuart Malin <email@hidden> wrote:
>
> On Mar 9, 2009, at 3:46 AM, email@hidden wrote:
>
>> Could you simply reset the toolbar selection to whatever it was
>> before, then display your sheet and then manually set the selection to
>> the new one if the user agrees?
>
> I could do that, but then the user would see the selected toolbar item
> change away, then back. Mail's preference doesn't behave that way, so I am
> presuming there must be some way to intercept the change and stop it, if
> appropriate. Perhaps the way do handle this is to prevent redisplay of the
> window... I'll have to explore this...
No need to "prevent" redisplay. Redisplay due to changes usually
happens at the end of the event loop cycle where the changes took
place. If you reset the selection before that happens (e.g. if the
toolbar item's action fires before the redisplay) then the user will
not see the intermediate state.
For example, consider this loop:
for(i = 0; i < 100; i++) [textField setIntValue:i];
The user will just see the text field display 99, and won't see it
counting up. The same *should* apply to your toolbar.
Mike
_______________________________________________
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