Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!bionet!agate!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: How do I do dynamic menus (adding/removing entries)? Message-ID: <30804@ucbvax.BERKELEY.EDU> Date: 22 Aug 89 06:22:05 GMT References: <10029@phoenix.Princeton.EDU> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 24 Recently a tech note came out of Apple that said, don't access menu data structures directly. This tech note, I've been told, was written by the guy who is writing the System 7.0 menu manager. So, the best way to write a dynamic windows menu is to write an MDEF that has 32 dummy strings in it (so you won't screw up the menu bar's menu flashing hook.) but which draws items based on the window list: for(win = FrontWindow();win != NIL;win = (WindowPtr) ((WindowPeek) win)->nextWindow){ if(((WindowPeek) win)->visible){ /* it goes in the menu */ } } If you want help, the source code for Apple's MDEF is available on MacNet, and probably other places. It is in assembly language. I believe it was Tim Maroney who first wrote about this technique. To whoever did, Thank you! --- David Phillip Oster --"Unix Version 7 was an improvement not Arpa: oster@dewey.soe.berkeley.edu --only over its predeccessors, but also its Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu --successors."