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: Kyle Sluder <email@hidden>
- Date: Tue, 21 May 2013 10:06:15 -0700
On May 21, 2013, at 9:52 AM, Steve Mills <email@hidden> wrote:
> On May 21, 2013, at 10:11:45, Kyle Sluder <email@hidden> wrote:
>
>> 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.
One concern is that you're not going to get a mouse event for clicks that happen in other apps' windows, but that might actually be what you want.
An alternative approach would be to put up a transparent shielding window underneath your browser, and have any clicks on it dismiss the browser.
>
>> 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.
Oh, I misunderstood you to mean the popup button cell was located on a modally-running browser window, not that it _spawned_ the window.
--Kyle Sluder
_______________________________________________
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