Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!dkuug!resam!andrew From: andrew@resam.dk (Leif Andrew Rump) Newsgroups: comp.windows.x Subject: Re: Xview: Interrupting a Notify Procedure Message-ID: <1991Apr29.091327.20052@resam.dk> Date: 29 Apr 91 09:13:27 GMT References: <3098@sparko.gwu.edu> <1991Apr24.211819.26355@aifh.ed.ac.uk> Organization: RESAM Project Office, SAS, CPHML-V Lines: 60 In <1991Apr24.211819.26355@aifh.ed.ac.uk> gordonc@aifh.ed.ac.uk (Gordon Cameron (RA DAI)) writes: >From article <3098@sparko.gwu.edu>, by darken@seas.gwu.edu: >> Here's the problem: >> Say I have a panel with 2 buttons on it. When I hit >> button #1, I want to start a process which will continue >> until button #2 is hit. How can I interrupt the notify >> procedure of button #1 when #2 is hit? As I see it, >> the pressing of #2 will not be recognized until #1 >> is completed processing. I looked into events in >> addition to notifications but nothing works yet and >> the manual is rather shady in this area. Thanks in >> advance! >> >You could try something like this : LOTS OF GOOD CODE DELETED >What this does is to run the routine 'do_something' when you press >the button #1. How ?? Pressing the button triggers the callback >which sets a global variable, and calls notify_stop. >The notifier returns to the top level, and then notify_start >and xv_main_loop return. >Periodically in this routine, you should make calls to >notify_dispatch(), which will make a single pass through the >notify cycle. If you have pressed button #2, then all you will >have done is to set the variable finished to TRUE. This is >detected, and 'do_something' returns so you end up at point (2). >You can now do whatever you want before continuing with the >application (perhaps doing some graphical output). >xv_main_loop then gets called again, and so you are back to where >you started. I've set a variable running, which when you unset >and do xv_destroy(Frame) will have the effect of quitting the >application. >(To be complete you should write a notify_interspose_destroy_func >which sets the variable running to FALSE, so the window quit works) >Hope this is useful - If you're interested, get the O'Reilly book >'XView Programming Manual' by Dan Heller, as its excellent. >(see pp 397-400) Well now we are back to good old MicroSoft Window code! Shouldn't the window manager be able to handle this by itself, like when the user envokes notify_dispatch()? Andrew Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark UUCP: andrew@ambra.dk, phone: +45 39 27 11 77 / Currently at Scandinavian Airline Systems =======/ UUCP: andrew@resam.dk, phone: +45 32 32 51 54 \ SAS, RESAM Project Office, CPHML-V, P.O.BOX 150, DK-2770 Kastrup, Denmark If it's broke, fix it (The MS-DOS way) If it aint broke, don't touch it (The Unix way) If we can't fix it, it ain't broke (Maintainer's Motto) If you can't fix it, fuck it (The U-boat way)