[comp.sys.mac.programmer] Getting Events in GetNextEvent patch

robinson@cs.wvu.wvnet.edu (John Robinson) (11/13/90)

I am working on an init that pops up a dialog window when you hit a
user-definable key sequence.  I accomplish this by patching GetNextEvent
and looking for the appropiate event in the Event Queue.  If it is there,
I pop-up my window.  How should I go about getting subsquent events for
my dialog should I manually look throught the event queue for mouse-down
events and the like.

Do I also need to patch WaitNextEvent or does it call GetNextEvent?

Any help or tips are appreciated.

Thanks In Advance.

mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) (11/13/90)

In article <998@h.cs.wvu.wvnet.edu> robinson@cs.wvu.wvnet.edu (John Robinson) writes:
>I am working on an init that pops up a dialog window when you hit a
>user-definable key sequence.  I accomplish this by patching GetNextEvent
>and looking for the appropiate event in the Event Queue.  If it is there,
>I pop-up my window.  How should I go about getting subsquent events for
>my dialog should I manually look throught the event queue for mouse-down
>events and the like.

Why do you search the Event Queue for your event in the first place. IMHO, it is
better to 
 
 - patch SystemEvent
 - wait for it to be called with your Hot Key
 - Do The Right Thing
 - return from SystemEvent indication the Hot Key had been handled.

During your popup dialog, you just can call GetNextEvent.
 
>Do I also need to patch WaitNextEvent or does it call GetNextEvent?

I think it currently does. I'd like to know myself, though, how long 
things will stay that way.

Matthias

-----
Matthias Neeracher                                   mneerach@iiic.ethz.ch
   "These days, though, you have to be pretty technical before you can 
    even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_

robinson@cs.wvu.wvnet.edu (John Robinson) (11/14/90)

In article <14605@neptune.inf.ethz.ch>, mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) writes:
> In article <998@h.cs.wvu.wvnet.edu> robinson@cs.wvu.wvnet.edu (John Robinson) writes:
> >I am working on an init that pops up a dialog window when you hit a
> >user-definable key sequence.  I accomplish this by patching GetNextEvent
> >and looking for the appropiate event in the Event Queue.  If it is there,
> >I pop-up my window.  How should I go about getting subsquent events for
> >my dialog should I manually look throught the event queue for mouse-down
> >events and the like.
>
> [Stuff Deleted...]
>
> During your popup dialog, you just can call GetNextEvent.
>  

But will this cause problems.  I don't want to allow a context-switch under
MultiFinder while the dialog is popped up.  Can this happen if I use
GetNextEvent.  I remember reading something about putting some magic value
in the windowkind attribute of a window to disallow a context-switch when
that window was frontmost am I on the right track.

Thanks for your help.

John

darweesh@zephyrus.crd.ge.com (Michael Darweesh) (11/14/90)

>>
>> During your popup dialog, you just can call GetNextEvent.
>>  
>
>But will this cause problems.  I don't want to allow a context-switch under
>MultiFinder while the dialog is popped up.  Can this happen if I use
>GetNextEvent.  I remember reading something about putting some magic value
>in the windowkind attribute of a window to disallow a context-switch when
>that window was frontmost am I on the right track.

Well, if the fronmost window is a dBoxProc (standard for Modal Dialog etc.), 
then GetNextEvent will disallow context switching under any normal/reasonable
circumstances.

-Mike Darweesh
weesh@crd.ge.com