Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!uunet!mcsun!ukc!icdoc!sot-ecs!snb90 From: snb90@uk.ac.soton.ecs (Stewart Brodie) Newsgroups: comp.sys.acorn Subject: Problem with procedures in BASIC Message-ID: <7970@ecs.soton.ac.uk> Date: 4 Jun 91 12:31:34 GMT Article-I.D.: ecs.7970 Sender: news@ecs.soton.ac.uk Lines: 40 Bcc: snb90 Originator: snb90@gloriana I have a small problem with a program I have written. It calls a procedure to load the window templates into memory and then create the windows so that the window handles are all set up correctly. However, when run, the program returns 'Not in a procedure at line 1740' where line 1740 is the ENDPROC statement. At first I thought that it was probably caused by BASICs stack begin corrupted due to lack of memory, so I increased the WimpSlot to 640K (The program only needs about 96K). The problem persisted, so I ensured that the block into which the templates were being loaded was large enough to hold the window with the most icons. I made the block over the size of the template file, but still the error comes. The code goes roughly along these lines ... (I can't remember the exact order of the SYS parameters, but they are right in my program.) DEF PROC_load_templates SYS "Wimp_LoadTemplate",,q%,indirect%,in_end%,,"Info" TO ,,indirect% SYS "Wimp_CreateWindow",,q% TO info_handle% SYS "Wimp_LoadTemplate",,q%,indirect%,in_end%,,"Folder" TO ,,indirect% SYS "Wimp_CreateWindow",,q% TO folder_handle% PROC_set_icon_text(info_handle%,0,"My Program Name") PROC_set_icon_text(info_handle%,1,"Purpose of Prog") PROC_set_icon_text(info_handle%,2,"Version of Prog") PROC_set_icon_text(info_handle%,3,"Author of Prog") ENDPROC Does anybody have any ideas as to the cause of this error? set_icon_text just sets icon texts up by poking the indirected icons and then setting their state. If I move the ENDPROC to before the first PROC_set_icon_text the problem still persists. Any clues would be most welcome. Stewart Brodie Department of Computer Science Southampton University