Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!caen!uflorida!cs.fau.edu!jeffb From: jeffb.bbs@shark.cs.fau.edu (Jeffrey Boser) Newsgroups: comp.sys.mac.programmer Subject: Re: Disabling menus when DA's are closed Message-ID: <3BRcy1w163w@shark.cs.fau.edu> Date: 5 Mar 91 20:12:49 GMT References: <1.27D17B52@mmug.edgar.mn.org> Sender: bbs@cs.fau.edu (Waffle BBS) Organization: Florida Atlantic University Lines: 30 jspencer@p510.f22.n282.z1.mmug.edgar.mn.org (Jim Spencer) writes: > Eric Hicks writes in a message to All > > Just a quick question that is quite probably rather simply solved. > > An application I'm writing never uses the edit menu while my > > main window is frontmost. (ie active) I've dimmed the menu, which > > is easily accomplished in ResEdit. My problem occurs with DA > > suppport. I can enable the menu when the DA comes up easily, > > and I also figured out how to tell when the user has chosen close > > from my file menu as a way to close a DA. My Problem occurs when > > the user, clicks the close box of a DA. How can I find out when > > this has happened so that I can dim the edit menu? I have a solution > > that "works" but it's so ugly that it's not worth posting. E-mail > > response is fine and I'll summarize to the net if there seems > > to be a need and the solution isn't obvious. Code fragments in > > either Pascal or C are fine, as they are relatively easy to translate > > If it's any help, I'm using THINK C 4.0. Thanks in advance... > >You should be disabling the menu whenever the DA's window is not in front. >In your main event loop, check FrontWindow. If it is your window, then >disable the menu. > > Jim Spencer (jspencer@mmug.edgar.mn.org) this will only chew up processor time, checking many times a second. what youneed to do is when the user clicks on a close box, call TrackGoAway, then if true, check if it is yours or a DA's. if a DA's, dim the Edit menu and call CloseDeskAcc. for other cases, dim the Edit menu when your windows are activated, and undim it when they are deactivated. .....Jeff