home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14969 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  2.1 KB

  1. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!news.claremont.edu!ucivax!gateway
  2. From: fonion@st-anns.ICS.UCI.EDU
  3. Subject: multifinder switching
  4. Message-ID: <9209031818.aa13404@Paris.ics.uci.edu>
  5. Newsgroups: comp.sys.mac.programmer
  6. Lines: 70
  7. Date: 4 Sep 92 01:22:26 GMT
  8.  
  9. Hi -
  10.     I'm having a problem getting my application to switch under
  11. multifinder by clicking the small icon in the upper righthand corner.
  12. I have read through Apple's 'Programmer's guide to multifinder,' and
  13. even modeled my event loop after their sample code, but my application
  14. still won't switch.  This is happening under system 6.0.7, but the problem
  15. also occurs under 7.0.  It does switch by selecting another program
  16. from the apple menu.
  17.     I have also noticed that the program does not switch when I
  18. click in the window of another program.  I thought that this would be
  19. handled by calling SystemClick(), but it doesn't seem to be working.
  20.     I'm including the relevant parts of my event loop in the hopes
  21. that some kind soul will enlighten me as to what I am doing wrong.
  22. Incidentally, I'm using Think C 5.0.
  23.  
  24.                 Thanks in advance,
  25.                   Fritz Onion  (fonion@ics.uci.edu)
  26.  
  27.  
  28. /* Event handler */
  29.  
  30. switch (gTheEvent.what) {
  31.     case nullEvent:
  32.         HandleNull();
  33.         break;
  34.     case mouseDown:
  35.         HandleMouseDown(1);
  36.         break;
  37.     case keyDown:
  38.     case autoKey:
  39.     theChar = gTheEvent.message & charCodeMask;
  40.     if ((gTheEvent.modifiers & cmdKey) != 0)
  41.         HandleMenuChoice(MenuKey(theChar));
  42.         break;
  43.     case updateEvt:
  44.         window = (WindowPtr)gTheEvent.message;
  45.         BeginUpdate(window);
  46.         <my update done here>
  47.         EndUpdate(window);
  48.         break;
  49.          case activateEvt:
  50.              window = (WindowPtr)gTheEvent.message;
  51.         if ((gTheEvent.modifiers & activeFlag) != 0)
  52.             SelectWindow(window);
  53.         break;
  54. }
  55.  
  56.  
  57. /* Handle mouse down events */
  58.  
  59. HandleMouseDown(menu_active)
  60. {
  61.     WindowPtr    whichWindow;
  62.     short int    thePart;
  63.     long int    menuChoice, windSize;
  64.  
  65.     thePart = FindWindow(gTheEvent.where, &whichWindow);
  66.     switch(thePart) {
  67.         case inMenuBar:
  68.             if (menu_active) {
  69.                 menuChoice =
  70.                     MenuSelect(gTheEvent.where);
  71.                 HandleMenuChoice(menuChoice);
  72.             }
  73.             break;
  74.         case inSysWindow:
  75.             SystemClick(&gTheEvent, whichWindow);
  76.             break;
  77.     }
  78. }
  79.