Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!mintaka!bloom-beacon!eru!kth.se!cyklop.nada.kth.se!news From: d88-jwa@byse.nada.kth.se (Jon W{tte) Newsgroups: comp.sys.mac.programmer Subject: Re: Disabling menus when DA's are closed Message-ID: <1991Mar6.074201.13324@nada.kth.se> Date: 6 Mar 91 07:42:01 GMT References: <1.27D17B52@mmug.edgar.mn.org> <3BRcy1w163w@shark.cs.fau.edu> Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 37 In article <> jeffb.bbs@shark.cs.fau.edu (Jeffrey Boser) writes: +-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, +-+-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. +-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 Bzzzzt. I'm sorry. You were all very close, but step down behind the curtains and we'll have some fabulous consolation prizes for you. The right answer is, of course, to check the windowKind of the FrontWindow just before you call MenuSelect or MenuKey - it's that simple. There won't be any noticeable delay before the menu appears either (not even on the Classic...) This is the way it's done in the Think Class Library, among other places. h+@nada.kth.se Jon W{tte "The IM-IV file manager chapter documents zillions of calls, all of which seem to do almost the same thing and none of which seem to do what I want them to do." -- Juri Munkki in comp.sys.mac.programmer