From: <bra...@om...> - 2005-03-28 23:01:53
|
I meant to say, self.menuBar = wx.GetTopLevelParent(self).menuBar Brad Allen/Dallas wrote on 03/28/2005 04:57:29 PM: > > Now I'm trying this within the tabs (Notebook pages): > > self.menuBar = self.wx.GetTopLevelParent(self).menuBar > > and then within the child windows: > > self.menuBar = self.getParent().menuBar > > Still not giving me the menu I want in the child windows. > > > pyt...@li... wrote on 03/28/2005 04:31:37 PM: > > > > > Whoops, I must be blind. Apparently PageBackground objects have no > > attribute getParent(). > > > > > > pyt...@li... wrote on 03/28/2005 > 04:21:51 PM: > > > > > > > > So, I've now got a main window with a tabbed interface and a > global menubar > > > that works for all the tabs. However, I still need to spawn a few > > > child windows, and these > > > need to have a copy of the main menubar. I have tried binding the > > > menubar of the > > > parent during the background initialization of the child window,like so: > > > > > > class MyBackground( model.Background): > > > def on_initialize(self, event): > > > self.menuBar = self.getParent().menuBar > > > > > > This doesn't work, although it doesn't seem to generate any > > > exceptions that I can see. > > > I have tried it on child windows whose resource file contains no > > > menubar, and I have tried > > > it on child windows whose resource file contains no menubar. > > > > > > Is there a method for refreshing the menubar? > > > > > > Thanks! > > > > > > "Kevin Altis" <al...@se...> wrote on 03/21/2005 10:25:35 AM: > > > > > > > On Mar 19, 2005, at 7:27 PM, bra...@om... wrote: > > > > > > > > > > > > > > I'm thinking I can get by with a tabbed interface for the > main window, > > > > > and go with small menu-less child windows for some of the individual > > > > > forms. For instance, an Employees tab would show a multiColumnList of > > > > > employees with search filters at the top. To edit an employee record, > > > > > the user doubleclicks a line and an employee edit window > pops up. This > > > > > seems like a workable approach. I guess I need to take a look at how > > > > > to implement the Notebook. > > > > > > > > > > > > > A tabbed interface seems like the way to go. There is currently no > > > > option to toggle the menubar for a window on and off in the > > > > resourceEditor. The reason I didn't do that is if someone made a bunch > > > > of menus and then accidentally got rid of them they would be pretty > > > > upset, and we have no undo feature. Instead when you create your > > > > background by using New under the File menu, select the appropriate > > > > template, for whether you want menus or not. > > > > > > > > The "main" menubar is always available to all windows. On the main > > > > background, it is just self.menuBar so on a child window you would > > > > access it as self.getParent().menuBar. > > > > > > > > When you use a single menubar and child windows, one of the things you > > > > have to watch out for is focus. Your main window will get the focus. If > > > > you run with the Message Watcher you'll see the deactivate, loseFocus, > > > > activate, loseFocus, gainFocus messages fire. Depending on what you > > > > want to do, you'll probably need to use the findFocus() method or some > > > > other method of tracking what is going on in your child window and > > > > saving that information in an on_deactivate method which you would then > > > > access in your main window menu item event handler. > > > > > > > > ka |