I want to have cmd+w close the front most open window. any help would be appreciated.
-
I set up the shortcut in the main menu
MainMenuBar
FileMenu
FileQuit
CloseWindow > cmd+w
-
I add a menu handler to a window, this works
about_window
menu Handler
closewindow
about_window.Close()
Return True
-
THIS DOES NOT WORK, it closes the about_window in #2 above
video_window
menu Handler
close window
VideoWindow.Close()
Return True
the CLOSE event/ menu handler for any window would normally only contain
self.close
using the name of a window … videowindow.close
implies that there is only ever one window of that name. (Implicit instantiation)
But for many apps, you dont use ‘the’ videowindow
You use ‘a’ videowindow, created like this:
MyWindow = new videowindow
The newly created window wont react to videowindow.close
It will close on MyWindow.close
And its close menu handle should just say self.close so it works no matter what you called it
made both windows self.close and ONLY the ‘about’ closed.
just found out by accident that cmd+. closes the ‘video’ window
what the heck, how did it get THAT functionality
I assigned both windows to use the MainMenuBar…still doesn’t work. ©?´?®?£¨¨?¨?´?´?ç?ø
I did what you said and it still does not work.
I made both windows have MainMenuBar as the Menu Bar.
video window

about window

Does the App have a closeWindow handler too?
Have you put breakpoints on to check the program flow?