Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU Newsgroups: comp.windows.x Subject: Re: How to simulate a blocked i/o in an event driven program? Message-ID: <9102250352.AA05492@lightning.McRCIM.McGill.EDU> Date: 25 Feb 91 03:52:04 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 52 >> popupwindow (); >> /* some processing which requires the user's data ... */ > The only half-acceptable argument to doing something like what you > want is that you want to port an old, dumb-terminal based application > or application support library to a windowed environment. > In case you are designing something from scratch, think carefully; > you WILL find a BETTER paradigm to do what you want to accomplish. This sounds to me like a comment coming from limited experience. It's true that this is *usually* the wrong paradigm, but there are occasional cases where it's the least of the available evils. (The alternatives in such circumstances generally involve deeply-nested control structure or large amounts of data in local variables; in all of these cases, turning the control structure into something event-driven results in painful code.) To pick an example that is somewhat too simple but will perhaps give some of the flavor of what I'm trying to say, suppose some code is doing a three-dimensional convolution and finds some exceptional condition that the user must resolve: for (var1=min1;var1<=max1;var1++) for (var2=min2;var2<=max2;var2++) for (var3=min3;var3<=max3;var3++) { if (special(elt[var1][var2][var3])) user_resolve(var1,var2,var3); do_voxel(var1,var2,var3); } Making this event-driven wrt user interaction involves breaking out of the loops and then arranging to re-enter them later. As I indicated, in this example it is not excessively painful. But it can get so. > As a hint, approach your problem with the question: > -- What should happen once the user has decided to pick one of the > options available in the popupwindow?? And if the answer is "pick up where we left off with ", where is complicated? You are generally correct; I don't mean to give the impression that blocking popups are always a good thing. But they are not quite of as little utility as you indicate. Of course, this is all opinion. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu