home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / Pascal / Skel 3.0i / Skel updatewindow.p < prev    next >
Encoding:
Text File  |  1994-04-12  |  988 b   |  36 lines  |  [TEXT/PJMM]

  1. unit UpdateWindow;
  2. interface
  3.     uses
  4.         Globals, ReDraw;
  5.  
  6.     procedure UpdateWindow (awindow: WindowPtr);
  7.  
  8. implementation
  9.  
  10. {Update the contents of the given window}
  11. {############################   UpdateWindow   ##########################}
  12.  
  13. {   This is our response to receipt of an update event for myWindow.}
  14. {   Since the window is likely to be inactive, the current GrafPort}
  15. {   will be elsewhere.  We must change it for drawing, yet leave it}
  16. {   as it was.}
  17.  
  18.     procedure UpdateWindow (awindow: WindowPtr);
  19.         var
  20.             saveport: GrafPtr;        (* to save and restore the old port *)
  21.     begin
  22.         BeginUpdate(awindow);    (* reset clipRgn etc to only redraw what's}
  23. {                   necessary. *)
  24.  
  25.         GetPort(saveport);    (* don't trash the port; we might be}
  26. {                   updating an inactive window *)
  27.         SetPort(awindow);        (* work in the specified window *)
  28.  
  29.         DrawWindow;        (* redraw contents of window *)
  30.  
  31.         SetPort(saveport);        (* all nice and tidy as before *)
  32.  
  33.         EndUpdate(awindow);
  34.  
  35.     end;                (* UpdateWindow *)
  36. end.