Path: utzoo!attcan!uunet!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!apple!agate!ucbvax!andrew.cmu.edu!gk5g+ From: gk5g+@andrew.cmu.edu (Gary Keim) Newsgroups: comp.soft-sys.andrew Subject: Re: moving menu items Message-ID: Date: 10 Oct 90 20:57:43 GMT References: Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 72 Excerpts from misc: 3-Oct-90 moving menu items Bill Schell@allegra.temp (743+1) > My view is a subclass of aptv. On the front-most menu card, I'm getting > "Save", "Switch File" and "Delete Window" menu selections from a parent > view. I would like to move "Save" and "Switch File" to the "File" card > and "Delete Window" to the "Window" card (the front menu card is getting > too crowded). Did you figure this out yet? There are two steps: (1) override those items that you want removed or moved-to-other-cards, (2) create bind entries for those items to be moved-to-other-cards. The First Part This is what Nathaniel was referring to in his message. Just create bind entries for those items to be moved or removed that have the same, exact menu-string as the bind entries that you want to override. Provide NULL values for the other bind entry fields. The Second Part To create bind entries for those items that you want to move to other cards, you have to provide a routine that will be called when that item is chosen. How do you do that when the item you're overriding is in another module. Well, first you have to load the class that you're overriding because to get a handle on the the original call-back routine you must make a proctable lookup. Let's have an example: You want to move 'Save' to the 'File' menu card. Let's call your aptv override foo. In foo__InitializeClass you make a call to class_Load("frame"); because the 'Save' menu item comes from the frame class. Here is the bind entry for 'Save' as it looks in andrew/atk/frame/framecmd.c: {"frame-save-file", "\030\023", 0, "Save~20", 0, frame_BufferMenus, (void (*)()) frame_SaveFile, "Saves buffer into its current file."}, You create a bind entry like this: {"foo-save-file", "\030\023", 0, "File, Save~20", 0, frame_BufferMenus , (void (*)()) foo_SaveFile, "Saves buffer into its current file."}, The only missing piece is foo_SaveFile. Where does that come from? Well, this is why you load frame in foo_InitializeClass. You must do a lookup of the proctable entry of the name frame-save-file. Here's how: static void foo_SaveFile(); boolean foo__InitializeClass( ClassID ) struct classheader *ClassID; { struct proctable_Entry *saveProcEnt = NULL; class_Load("frame"); if(saveProcEnt = proctable_Lookup("frame-save-file")) { foo_SaveFile = proctable_GetFunction(saveProcEnt); } else { printf("foo: couldn't lookup proctable entry frame-save-file.\n"); return(FALSE); } return(TRUE); } How does that sound? If you have any problems just send e-mail. Gary Keim ATK Group