home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14836 < prev    next >
Encoding:
Text File  |  1992-09-01  |  2.0 KB  |  64 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!gatech!news.byu.edu!news.mtholyoke.edu!nic.umass.edu!titan.ucc.umass.edu!rjr
  3. From: rjr@titan.ucc.umass.edu (Richard J. Resnick)
  4. Subject: Event Loop
  5. Message-ID: <1992Sep1.152720.12544@nic.umass.edu>
  6. Sender: usenet@nic.umass.edu (USENET News System)
  7. Nntp-Posting-Host: titan.ucc.umass.edu
  8. Organization: University of Massachusetts, Amherst
  9. Date: Tue, 1 Sep 1992 15:27:20 GMT
  10. Lines: 52
  11.  
  12. Hello,
  13.  
  14. I don't know if it is "ok" protocol to post code questions here... I apologize
  15. in advance for any annoyance I may create. I did check the faq, and it wasn't
  16. any help. 
  17.  
  18. I am a beginning MAC programmer, and am working with the event loop thingy.
  19. I am trying to write a simple program which brings up the text window, and
  20. then just runs through the event loop until you click on the menu bar. But when
  21. I run it, it just hangs on me, and the debugger says that isEvent is _never_
  22. true! Will someone enlighten me as to why this code doesn't work? Thanks in 
  23. advance.
  24.  
  25. begin
  26.  
  27.   repeat
  28.     isEvent := GetNextEvent(everyEvent, thisEvent);
  29.  
  30.     case thisEvent.what of
  31.         nullEvent: {Do nothing} 
  32.            begin
  33.            end;
  34.         mouseDown: {where is the mouse clicked?}
  35.            begin
  36.               whereIsIt := FindWindow(thisEvent.where, thisWindow);
  37.  
  38.               case whereisIT of
  39.                   0, 3: {In drawing window}
  40.                      gameOver := false;
  41.                   1: {in Menubar}
  42.                      gameOver := true;
  43.               end; {case whereIsit}
  44.  
  45.            end; {mouseDown}
  46.  
  47.         otherwise:
  48.            begin
  49.            end;
  50.  
  51.     end; {case thisEvent.What}
  52.   until gameOver;
  53.  
  54. end.
  55.  
  56. *=====/=== ===^=====.==='========`============/==== = ^========~====/====^ =-=*
  57. *        "I'll return your fire, if you take away your vultures..."           *
  58. *                       - Prometheus, gaining leverage                        *
  59. *===^==/=======\======= ===`====='===> ==========>====.===== =^=====/====*====*
  60.                   Internet Address: rjr@titan.ucc.umass.edu
  61.  
  62.  
  63.  
  64.