Path: utzoo!attcan!uunet!world!decwrl!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: Can I modify the Text Window title in THINK Pascal? Message-ID: <10623@goofy.Apple.COM> Date: 9 Oct 90 16:22:18 GMT References: <1990Oct9.062443.18141@agate.berkeley.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 37 bmyers@garnet.berkeley.edu (Brian Myers) writes: >The following simple program does not work (in THINK's Lightspeed Pascal): > >program ChangeTitle; >var > wPtr: WindowPtr; > theTitle: Str255; >begin > ShowText; {makes TextWindow visible, active} > wPtr:=FrontWindow; {should give handle to Text Window} > GetWTitle(wPtr, theTitle); {should retrieve title string} > WriteLn(theTitle); {should display title string} >end. > >What actually happens is a string of garbage appears as output from that last >WriteLn. SetWTitle also has no effect--this program was what I tried when I >couldn't make SetWTitle work. > >I now suspect that THINK Pascal somehow protects its standard windows (Text, >Drawing, etc) from your own programs as they run. Might the compiler >somehow remove these windows, even though they exist on the screen, from the >system queue? Is that even possible? Or why else am I getting garbage? Have you thought about initializing theTitle with something. Otherwise, whatever was in that part of memory when your routine got called would be used. Stuff like: theTitle:='A Real Title' or theTitle:=GetString(5)^^ work pretty well... :-) steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ whoami? Steve Christensen snail: Apple Computer, 20525 Mariani Ave, MS-81CS, Cupertino, CA 95014 Internet: stevec@goofy.apple.com AppleLink: stevec CompuServe: 76174,1712