Path: utzoo!attcan!uunet!snorkelwacker!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: <8b58Vhi00VsWE2ioxd@andrew.cmu.edu> Date: 11 Oct 90 14:57:49 GMT References: Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 66 There is a small problem with my solution to the problem of moving menu items to different cards. I directed that you get a handle on the original call-back routine via a proctable lookup, and then use that routine in the overriding bind entry. This is incorrect because then that routine (foo_SaveFile, really frame_SaveFile) will be called with (struct foo *) as the first argument when it expects a (struct frame *). So you must define your own routine to be used in the overriding bind entry, and in that routine you must get your frame pointer from self. Then make the original call-back that you looked-up in foo_InitializeClass, with the proper argument. So, here is the real code: static void frame_SaveFile(), foo_SaveFile(); static boolean FindMyFrame(); #define Parent(v) ((v)->header.view.parent) static void foo_SaveFile( self, rock ) struct foo *self; long rock; { struct frame *frame = NULL; if(frame = frame_Enumerate(FindMyFrame,foo_GetIM(self))) frame_SaveFile(frame,rock); else printf("foo: could not find frame.\n"); } static boolean FindMyFrame( frame, im ) struct frame *frame; long im; { return((struct view*) im == Parent(frame)); } static struct bind_Description fooBindings[]={ {"foo-save-file", "\030\023", 0, "File, Save~20", 0, frame_BufferMenus , (void (*)()) foo_SaveFile, "Saves buffer into its current file."}, } boolean foo__InitializeClass( ClassID ) struct classheader *ClassID; { struct proctable_Entry *saveProcEnt = NULL; class_Load("frame"); if(saveProcEnt = proctable_Lookup("frame-save-file")) { frame_SaveFile = proctable_GetFunction(saveProcEnt); } else { printf("foo: couldn't lookup proctable entry frame-save-file.\n"); return(FALSE); } return(TRUE); } Have Fun. Gary Keim ATK Group