Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sunybcs!acsu.buffalo.edu From: volaski@acsu.buffalo.edu (maurice volaski) Newsgroups: comp.sys.mac.programmer Subject: THINK PASCAL's Observe not working right?! Message-ID: <15719@eerie.acsu.Buffalo.EDU> Date: 12 Jan 90 18:08:05 GMT Sender: nobody@acsu.Buffalo.EDU Organization: SUNY at Buffalo Lines: 51 Below is a program written in THINK Pascal that performs the Macintosh's famous task of command-period to cancel. The programs loops idly until command-period is pressed and then it quits. However, according to one aspect of THINK Pascal's debugger it shouldn't work. In the Lightsbug window, the variables are updated properly, but in the Observe window they are not. The variable temp is appropriately set to true when command-period is set to true, but the the function result CmdPeriod is not set to the value of temp! This only occurs in the observe window, not anywhere else. Anyone familiar with problems like this one and others in THINK Pascal's Observe window? Rich Siegal, are you listening? program testcmdperiod; var BtnUpdate: boolean; function CmdPeriod: boolean; const periodKey = 46; var chCode: integer; stopEvent: EventRecord; temp: boolean; begin CmdPeriod := false; if GetNextEvent(keyDownMask, stopEvent) then begin with stopEvent do begin if (BitAnd(modifiers, CmdKey) <> 0) and (BitAnd(message, CharCodeMask) = periodKey) then temp := true else temp := false; end; end else temp := false; CmdPeriod := temp; {This line doesn't work according to only Observe} end; begin BtnUpdate := false; repeat begin ; end; until CmdPeriod; BtnUpdate := true; end.