Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!apple!well!wdh From: wdh@well.sf.ca.us (Bill Hofmann) Newsgroups: comp.sys.mac.programmer Subject: Re: What am I doing wrong?--modal dialog use crashes Summary: Use SetPort Message-ID: <24702@well.sf.ca.us> Date: 10 May 91 17:43:44 GMT References: <1991May7.234354.26431@agate.berkeley.edu> <13405@goofy.Apple.COM> Organization: Flashpoint Lines: 16 For the second time this week, if you create a window, you must call SetPort before you use it. Jim Reekes is wrong here, the original poster *does* pass the address of a block of memory big enough to hold a DialogRecord, and does all the right things to get rid of memory. He is right to point out the silliness of calling ShowWindow more than once (or even once, if the DLOG indicates the window should be visible). Some things to keep in mind: -ShowWindow, NewWindow, GetNewWindow, NewDialog, GetNewDialog, and every other window and dialog manager routine *does not*, repeat, *NOT* ever call SetPort to make anything the current port, at least as you should know. -You *must* call SetPort yourself, no one will do it for you. -Bill Hofmann Not a ToolBox Engineer