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

  1. Path: sparky!uunet!sun-barr!olivea!spool.mu.edu!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!ogicse!qiclab!baer
  2. From: baer@qiclab.scn.rain.com (Ken Baer)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Problems with GrowWindow().
  5. Message-ID: <1992Sep15.193548.1859@qiclab.scn.rain.com>
  6. Date: 15 Sep 92 19:35:48 GMT
  7. Organization: SCN Research/Qic Laboratories of Tigard, Oregon.
  8. Lines: 52
  9.  
  10.  
  11. I have a mysterious problem with the toolbox GrowWindow() call.  When I click
  12. on the window's growbox, I don't get an Xor'd rect that follows the mouse, and
  13. the values returned and put in the rect are way off screen.  I used code
  14. from the book Macintosh Programming Primer volume 1.  I'm at a loss why this
  15. isn't working.  Here is the code fragment of what I'm doing.  BTW, other
  16. events coming into this window work fine.
  17.  
  18.  BOOL MsgToMessage( WINDOW window, EventRecord *event )
  19. {
  20.    short thePart, theMenu, theItem, lo, high;
  21.    WindowPtr whichWindow;
  22.    static LONG lasttick = 0, newtick;
  23.    LONG menuChoice, windSize;
  24.    Str255 accName;
  25.    short accNumber, itemNumber;
  26.    GrafPtr port;
  27.    RECT sizeRect;
  28.  
  29.    Message.Class = 0;        
  30.  
  31.    switch (event->what) {
  32.    case mouseDown:
  33.       thePart = FindWindow( event->where, &whichWindow );
  34.       switch (thePart) {
  35.          case inGrow:
  36.             windSize = GrowWindow( whichWindow, event->where, &sizeRect );
  37.             if ( windSize != 0 ) {
  38.                GetPort( &port );
  39.                SetPort( (GrafPtr)whichWindow );
  40.                EraseRect( &whichWindow->portRect );
  41.                lo = LoWord(windSize);
  42.                high = HiWord(windSize);
  43.                SizeWindow( whichWindow, lo, high, TRUE );
  44.                InvalRect( &whichWindow->portRect );
  45.                SetPort( port );
  46.             }
  47.             break;
  48.       }
  49.       break;
  50.    }
  51. }
  52.  
  53. I am #including all relevent function prototypes.
  54.  
  55. Am I missing something obvious?  Any helpful comments will be appreciated.
  56.     -Ken Baer.
  57.     baer@qiclab.scn.rain.com
  58. -- 
  59.     //    -Ken Baer.  Programmer/Animator, Hash Enterprises
  60.   \X/     Usenet: baer@qiclab.UUCP  /  Office: (206)573-9427
  61.           "Hey, I think a glacier just passed us!" - Andy from Joyride
  62.