Re: modal windows (again)
Re: modal windows (again)
- Subject: Re: modal windows (again)
- From: Devon E Bowen <email@hidden>
- Date: Tue, 9 Mar 2004 14:11:10 -0500 (EST)
>
Either it blocks the application or it is used as a sheet and only
>
blocks a window. Do you want any of these two things?
>
>
What else do you think modal means?
In the world in my mind, modal should block graphical events. So when
I have a modal window, all other windows are frozen and menu options
are disabled. The user's attention is forcibly set to that window. But
the user is not the only thing that triggers events. I should still
be able to get events from other sources. Blocking the GUI is not the
same as blocking the app. Say data arrives on a socket, for example.
Does it wait indefinitely while the user goes to lunch and doesn't
answer the question on his screen? I note that most Mac apps do work
this way but I find it rather primitive.
>
In your example you *do* run the main event loop, and *additionally*
>
runs a sort of local event loop, initiated by a timer.
Right. That's how I thought runModalSession was supposed to be used.
Ie, I thought it was a "tiny" event loop for the window that needed
to be given time once in a while by the big loop.
>
Well, yes, sorta... modality is really something to avoid in most
>
applications. It is only used for very short lived requesters such as
>
"I need all of your attention, don't use any other windows before
>
answering this question!".
Agreed. But the way you word that is as if the windows are the
primary part of the app. Not true in many cases (like mine). For me
the background event handling work needs to keep running regardless
of the window environment. But this focus on the windows does seem
to pervade the Mac development world. A while back I tried to get
info about doing non-blocking file writes and people thought I was
crazy. Coming from the UNIX world, I'm used to be able to select()
on anything and get full non-blocking.
>
However, if you handle network events e.g. via NSFileHandle, then the
>
events will most likely be dispatched each time you make a call to
>
runModalSession (this is why you have to repeatedly call it in your
>
loop).
Might work. But it would make the stack growth odd. And things like
that make me nervous since they can easily break in the future. But
at the moment, I don't see another option other than something really
complex like breaking things into threads or daughter processes.
Anyway, thanks for the chat. I think I understand the problem better.
Devon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.