Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!tramp!hartkopf From: hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) Newsgroups: comp.sys.apple Subject: 2 more IIGS programming questions Message-ID: <9760@boulder.Colorado.EDU> Date: 29 Jun 89 02:06:16 GMT Sender: news@boulder.Colorado.EDU Reply-To: hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) Organization: University of Colorado, Boulder Lines: 84 1) I've been having a problem getting a new desk accessory which needs to use Standard File (SF) to work. The problem occurs when, since SF is not assumed to be loaded, I need to load and start it up. Here is the TML Pascal code I use to do it: {global} var NDALoadedSF: Boolean; {did I need to load SF, or not} procedure LoadStandardFile; var MemID: Integer; {application ID assigned by Memory Manager} ToolsZeroPage: Handle; {handle to zero page memory for tools} ToolRec: ToolTable; SvToolErrorNum, Btn: Integer; {button} begin MemID := MMStartUp; {initialize Memory Manager} ToolsZeroPage := NewHandle( 1 * 256, {allocate 1 page} MemID, {user ID for memory blocks} FixedBank + PageAligned + FixedBlk + Locked, {attributes} ptr(0)); {start in bank 0} ToolRec.NumTools := 12; {number of tools needed to load} ToolRec.Tools[1].TSNum := 23; {Standard File} ToolRec.Tools[1].MinVersion := 0; repeat LoadTools(ToolRec); {load tools} SvToolErrorNum := ToolErrorNum; if SvToolErrorNum <> 0 then {error in loading tools} begin Btn := TLMountVolume(100, 40, 'Error loading tools', 'Insert System Disk', 'Ok', 'Cancel'); if Btn <> 1 then SysFailMgr(SvToolErrorNum, 'Unable to load tools'); end; until SvToolErrorNum = 0; SFStartUp(MemID, LoWord(ToolsZeroPage^) + $700); end; procedure DAInit(Code: Integer); Dummy: Integer; begin if Code = 0 then {closing NDA} begin if NDALoadedSF then SFShutDown end else {opening NDA} begin Dummy := SFStatus; if IsToolError then begin LoadStandardFile; end else NDALoadedSF := true; end else NDALoadedSF := false; end; end; So far everything works fine: it loads and starts up SF if it needs to. The problems occurs in the Finder which doesn't load SF, so my NDA has to. When I try to launch any ProDOS 8 program, the system crashes with the error message "Sorry, system error $0201 occurred while trying to run the next application." ProDOS 16 or GS/OS program launching works fine. If I remove the SF loading code from the NDA, then everything works great. I'm sure I'm doing something wrong. Any suggestions? 2) In a program I'm writing I need to draw a window (it's a help window) with a lot of text in it--maybe 8 typed pages. Now of course not all of this text can be displayed at once in the window, but whenever the window needs to be updated (e.g. when it's first drawn, when the user uses the window's scroll bar, etc.) it takes a long time to redraw because it seems to have to redraw ALL of the text, even though only a small part of it shows. I'm using DrawString to draw the text in the window. Any suggestions on making it faster, like a word processor or text editor does? Thanks a lot.