Path: utzoo!news-server.csri.toronto.edu!rutgers!usc!wuarchive!rex!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: <6D6iy1w163w@shark.cs.fau.edu> Date: 9 Mar 91 07:02:04 GMT References: <1991Mar6.074201.13324@nada.kth.se> Sender: bbs@cs.fau.edu (Waffle BBS) Organization: Florida Atlantic University Lines: 43 d88-jwa@byse.nada.kth.se (Jon W{tte) writes: > 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, [various responses, including mine, deleted] > 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...) no, this is very wrong. ok, in full, here is what should be done: deactivation or closing of your window: undim the edit menu activation of your window: dim the edit menu you can find out what window it is by checking the windowKind field of the window's record (negative if it is the DA's) if a DA is closed, another might be beneath it, so do not dim the menu. if your window is opened, it will generate an activate event (if you create it invisible and ShowWindow() it) if a DA is opened, it will generate a deact for your window the problem with your way is that it deals only with menu items. according to the HINs, if an entire menu is innappropriate, dim it. besides, dimming all of the items only works on the first 32 (i think). > This is the way it's done in the Think Class Library, among > other places. actually the Think Class Lib uses this method for specific menu *items* not menus. and the Think Class Library is more than a bit flakey in some areas. if you are writing anything worthwhile, it might be best to use TCL only as a base, and build your own.