Re: Running event loop while showing non-standard popup
Re: Running event loop while showing non-standard popup
- Subject: Re: Running event loop while showing non-standard popup
- From: Steve Mills <email@hidden>
- Date: Tue, 21 May 2013 11:52:07 -0500
On May 21, 2013, at 10:11:45, Kyle Sluder <email@hidden> wrote:
> It quite clearly says it will not work with nested event loops. +runModalForWindow: is but one way to run a nested event loop. It's not the job of every method's documentation to teach you how the entire framework works.
The whole point of documentation is to educate the user, not to make them waste time guessing and trying things.
> You could try it, but +runModalForWindow might not invoke -sendEvent: to dispatch the events it pulls off the event queue within its nested runloop invocation.
I meant using sendEvent for handling all the events for this popup window *instead of* using runModalForWindow, since that won't work for clicks out side the window to dismiss it.
> Let's back up to your original question. Why do you need to run a runloop at all? NSPopupButtonCell will do that for you, and it will correctly handle the case where the user clicks outside the menu to dismiss.
>
> Look up -performClickWithFrame:inView:.
I'm not sure how performClickWithFrame helps here. It's documentation says it displays the menu. That's not what I've been asking about. In our NSPopUpButtonCell subclass's trackMouse method, we create a window to display instead of showing the menu. This window has a 3-column NSBrowser in it for displaying a tree type structure. Clicks in column 1 will change what's shown in columns 2 and 3. Clicks in column 2 will change what's shown in column 3. Column 3 is the place where choices are ultimately made. Each column is individually scrollable. So, this control deviates from normal popup usage in that you can't mouseDown/drag/mouseUp to make a choice. A mouseDown/mouseUp shows it, multiple mouseDown/mouseUps can be made until a final mouseDown/mouseUp is made in the 3rd column, or the arrow and return keys can be used to navigate and make a final choice.
--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157
_______________________________________________
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