Re: How to detect clicks outside of modal window?
Re: How to detect clicks outside of modal window?
- Subject: Re: How to detect clicks outside of modal window?
- From: Laurent Daudelin <email@hidden>
- Date: Wed, 02 Nov 2011 17:10:49 -0700
On Nov 2, 2011, at 16:55, Vojtěch Meluzín wrote:
>>> I'm using modal windows using runModalForWindow and I'd like to implement
>>> probably a slightly untypical thing - when a user clicks outside of the
>>> window, it gets closed, like he clicked cancel button or something. The
>>> idea is that this would simulate a popup menu. I know it's not exactly
>>> typical, but my plugins/apps would benefit from it a lot and I cannot use
>>> normal menu classes, because it's a multiplatform GUI system, which just
>>> works different way.
>>
>> Between this and your previous post about no window title, it sounds like
>> maybe you should be looking at a floating panel instead of a modal dialog
>> (with some custom event handling).
>>
>
> This is just a special case. In basically all platforms so far it was quite
> easy to find a simple way to detect, when user clicks outside of the
> window, so in case particular window should be a "menu", then I could just
> close it on user click outside (or OS did that automatically). Minimum
> crossplatform code, which is always a good thing.
While I agree that minimum cross-platform code is always a good thing, I think you need to do a better separation from the core functionalities of your software and the generally accepted UI practices on the platform you're porting. I don't remember seeing any apps or windows that behave the way you're describing it. Of course, you can completely subclass NSWindow to get what you want but, IMHO, flatly ignoring UI conventions on a given platform is going to alienate the users and will probably have an impact on the number of sales/downloads you get. Porting an app from one platform to another is just not trying to compile the code. You have to invest yourself in understanding how things are done on the platform you want to support, else the users will look somewhere else. I'm pretty sure that most people on this list have seen their share of poorly ported Windows apps to the Mac and it's not pretty…
Just my $0.02...
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
Logiciels Nemesys Software email@hidden_______________________________________________
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