"Windows" menu on Mac

It--and several entries--are automatically generated on Mac OS 10.5.6. The defaults are nice. Unfortunately, I don't know how to control them in my code. Are the Mac-specific toolbar behaviors part of wxwidgets or wxpython? Are they documented anywhere?

Randolph

R Fritz wrote:

It--and several entries--are automatically generated on Mac OS 10.5.6. The defaults are nice. Unfortunately, I don't know how to control them in my code. Are the Mac-specific toolbar behaviors part of wxwidgets or wxpython? Are they documented anywhere?

Randolph

Without more details, it's hard to really know what you're talking about. Menus on Mac can be somewhat controlled via the default ids you pass to the menu items. If you give them the correct defaults than the menu items will show up where they're supposed to. Or that's what I'm told. Since I don't have a Mac, I cannot confirm this. If you want granular control, don't use default ids.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

There does not appear to be a default ID for the “Windows” menu; at least there is none listed at <http://docs.wxwidgets.org/stable/wx_stdevtid.html>. I know about the “Quit” and “Help” menus, though I do not know all the details of their behavior. But the “Windows” menu is much more problematic. Even if I don’t give code to create it, it appears with “Minimize”, “Zoom”, and “Bring All to Front” menu items–I have not so far been able to override these, let alone turn them off. I was hoping that someone would know more off the top of their head. Failing that, would someone be kind enough to point me to the code where these behaviors are implemented?

Randolph

···

On Jan 2, 2009, at 5:10 PM, Mike Driscoll wrote:

R Fritz wrote:

It–and several entries–are automatically generated on Mac OS 10.5.6. The defaults are nice. Unfortunately, I don’t know how to control them in my code. Are the Mac-specific toolbar behaviors part of wxwidgets or wxpython? Are they documented anywhere?

Randolph

Without more details, it’s hard to really know what you’re talking about. Menus on Mac can be somewhat controlled via the default ids you pass to the menu items. If you give them the correct defaults than the menu items will show up where they’re supposed to. Or that’s what I’m told. Since I don’t have a Mac, I cannot confirm this. If you want granular control, don’t use default ids.

\

Hi!

There does not appear to be a default ID for the "Windows" menu; at least there is none listed at <http://docs.wxwidgets.org/stable/wx_stdevtid.html&gt;\. I know about the "Quit" and "Help" menus, though I do not know all the details of their behavior. But the "Windows" menu is much more problematic. Even if I don't give code to create it, it appears with "Minimize", "Zoom", and "Bring All to Front" menu items--I have not so far been able to override these, let alone turn them off. I was hoping that someone would know more off the top of their head. Failing that, would someone be kind enough to point me to the code where these behaviors are implemented?

Randolph

I admit that I don't really know what you're talking about since I don't have a Mac and you didn't provide a screenshot. But are you talking about the Minimize / Maximize and Close (X) buttons that one normally sees on Windows? If so, you probably just need to manipulate the frame's styles. For example, the default style is wx.DEFAULT_FRAME_STYLE, which gives you all the normal buttons and allows resizing (I think). I don't know all the styles off the top of my head, but here's a few of them:

wx.STAY_ON_TOP
wx.CLOSE_BOX
wx.SYSTEM_MENU
wx.CAPTION
wx.MINIMIZE_BOX
wx.RESIZE_BORDER

You can chain them together like this:

self.frame = wx.Frame(None, -1, title='My Frame', style=wx.STAY_ON_TOP | wx.SYSTEM_MENU | wx.RESIZE_BORDER)

If that's not what you're talking about, then hopefully Cody or Robin or one of the other Mac guys can come forward.

Mike

···

On Jan 2, 2009, at 5:10 PM, Mike Driscoll wrote:

R Fritz wrote:

It--and several entries--are automatically generated on Mac OS 10.5.6. The defaults are nice. Unfortunately, I don't know how to control them in my code. Are the Mac-specific toolbar behaviors part of wxwidgets or wxpython? Are they documented anywhere?

Randolph

Without more details, it's hard to really know what you're talking about. Menus on Mac can be somewhat controlled via the default ids you pass to the menu items. If you give them the correct defaults than the menu items will show up where they're supposed to. Or that's what I'm told. Since I don't have a Mac, I cannot confirm this. If you want granular control, don't use default ids.

\
------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hello,

···

On Jan 3, 2009, at 11:14 AM, R Fritz wrote:

There does not appear to be a default ID for the “Windows” menu; at least there is none listed at <http://docs.wxwidgets.org/stable/wx_stdevtid.html>. I know about the “Quit” and “Help” menus, though I do not know all the details of their behavior. But the “Windows” menu is much more problematic. Even if I don’t give code to create it, it appears with “Minimize”, “Zoom”, and “Bring All to Front” menu items–I have not so far been able to override these, let alone turn them off. I was hoping that someone would know more off the top of their head. Failing that, would someone be kind enough to point me to the code where these behaviors are implemented?

You can override using the system supplied Window menu by calling: wx.MenuBar.SetAutoWindowMenu(False). Note that SetAutoWindowMenu is a static method.

Additional Info:

http://wiki.wxpython.org/Optimizing%20for%20Mac%20OS%20X

Cody

Thanks!

Randolph

···

On Jan 3, 2009, at 9:36 AM, Cody Precord wrote:

Hello,

On Jan 3, 2009, at 11:14 AM, R Fritz wrote:

There does not appear to be a default ID for the "Windows" menu; at least there is none listed at <http://docs.wxwidgets.org/stable/wx_stdevtid.html&gt;\. I know about the "Quit" and "Help" menus, though I do not know all the details of their behavior. But the "Windows" menu is much more problematic. Even if I don't give code to create it, it appears with "Minimize", "Zoom", and "Bring All to Front" menu items--I have not so far been able to override these, let alone turn them off. I was hoping that someone would know more off the top of their head. Failing that, would someone be kind enough to point me to the code where these behaviors are implemented?

You can override using the system supplied Window menu by calling: wx.MenuBar.SetAutoWindowMenu(False). Note that SetAutoWindowMenu is a static method.

Additional Info:
Optimizing for Mac OS X - wxPyWiki

Cody
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

R Fritz wrote:

There does not appear to be a default ID for the "Windows" menu; at least there is none listed at <http://docs.wxwidgets.org/stable/wx_stdevtid.html&gt;\. I know about the "Quit" and "Help" menus, though I do not know all the details of their behavior.

wxWidgets tries to automatically help your application conform to Apple's HIG, and to not require you to write platform specific code for these things that are done differently on different platforms. For standard menu items it relocates items with specific IDs to the application menu and removes them from where you added them to the menubar. You can either tell wx which IDs to use to look for these special items, or you can just use the stock IDs when you create the items. The IDs are wx.ID_QUIT, wx.ID_ABOUT, and wx.ID_PREFERENCES.

wxWidgets on Mac will also automatically create Window and Help menus in order to conform to the HIG, and will try to merge any items you create on a "&Window" or "&Help" menu with the menus that it creates. As Cody mentioned you can turn off the Window menu, but I believe that the Help menu is always required.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!