[comp.sys.mac.programmer] Quickdraw: what's the story?

steveh@tasman.cc.utas.edu.au (Steven Howell) (06/06/91)

G'day everyone,
	I'm experiencing a few simple problems with quickdraw. It's probably
a basic problem, but I'm pretty new to programming with the toolbox,
so here goes: (I'm using Think Pascal 2.0)

My application starts up and lets the user open a window containing a
graphic (for the sake of argument constructed with simple moveto's and
lineto's). I set the current port to my window with
SetPort(@mywindowrecord.port). The shape draws just fine. Now the problem:
If the user pulls down the apple menu and selects "about", a modal dialog
box appears, partially obscuring the graphic. When the
dialog box is "put away", it leaves a hole in my window. My event loop
successfully detects the updateEvent and faithfully attempts to redraw
the window contents - however, none of my quickdraw calls show up. (Even
if I halt my program, select "Instant" and type in a few moveto's and
lineto's, nothing appears. What am I doing wrong?

Thanks in advance,
steve h.

ps. I have tried re-calling Setport. I have also tried calling SelectWindow
(a bit pointless, since it's already selected) and penpat(black), all to
no avail. Help!

gourdol@imag.imag.fr (Gourdol Arnaud) (06/07/91)

In article <steveh.676185942@tasman> steveh@tasman.cc.utas.edu.au (Steven Howell) writes:
[I can't update my window]

On receiving the update event you must call SetPort, 
then call BeginUpdate, then update your window, then call
EndUpdate.

Arno.

-- 
    /=============================//===================================/
   / Arno Gourdol.               // On the Netland:  Gourdol@imag.fr  /
  / "A keyboard ! How quaint !"   -- Scott, Star Trek                /
 /=============================//===================================/