Special Menus in Menubars

Certain menus in a menubar will be treated specially.

  • On the Macintosh, access to the special Apple and Help menus is provided.
  • On Windows, access to the Windows System menu in each window is provided.
  • On X Windows, a special right-justified help menu is provided.

In all cases, these menus must be created as follows:

(#<widget> 'create-widget 'menu #:widget-name "apple")  ;; Apple
(#<widget> 'create-widget 'menu #:widget-name "system") ;; Windows
(#<widget> 'create-widget 'menu #:widget-name "help")   ;; X Windows

When Tk sees an Apple menu on the Macintosh, that menu's contents make up the first items of the Apple menu on the screen whenever the window containing the menubar is in front. The menu is the first one that the user sees and has a title which is an Apple logo. After all of the Tk-defined items, the menu will have a separator, followed by all of the items in the user's Apple Menu Items folder. Since the System uses a different menu definition procedure for the Apple menu than Tk uses for its menus, and the system APIs do not fully support everything Tk tries to do, the menu item will only have its text displayed. No font attributes, images, bitmaps, or colors will be displayed. In addition, a menu with a tearoff item will have the tearoff item displayed as "(TearOff)".

When Tk see a Help menu on the Macintosh, the menu's contents are appended to the standard help menu on the right of the user's menubar whenever the user's menubar is in front. The first items in the menu are provided by Apple. Similar to the Apple Menu, cusomization in this menu is limited to what the system provides.

When Tk sees a System menu on Windows, its items are appended to the system menu that the menubar is attached to. This menu has an icon representing a spacebar, and can be invoked with the mouse or by typing Alt+Spacebar. Due to limitations in the Windows API, any font changes, colors, images, bitmaps, or tearoff images will not appear in the system menu.

When Tk see a Help menu on X Windows, the menu is moved to be last in the menubar and is right justified.


© Author | Home | Sitemap