Report-an-Apple-bug Friday! 11

2006-03-17 23:56:00 -08:00

This bug is -[NSMenu menuBarHeight] always returns 0.0f. It was filed on 2006-03-17 at 23:55.

UPDATE 2006-03-25: Uploaded test app to GeoCities.


Summary:

NSMenu‘s -menuBarHeight method always returns 0.0f. Even the main menu’s.

Steps to Reproduce:

  1. Call [[NSApp mainMenu] menuBarHeight].

Expected Results:

The method returns 22.0f.

Actual Results:

The method returns 0.0f.

Regression:

None known.

Notes:

Appearance Manager (in the form of the GetThemeMenuBarHeight function) and NSMenuView (in its +menuBarHeight method) both return 22.0f, the correct height of the menu bar under Tiger.

The documentation for +[NSMenuView menuBarHeight] recommends using -[NSMenu menuBarHeight] instead.

This method is superseded in Mac OS X v10.4 by the NSMenu menuBarHeight instance method.

Following this advice would break one’s app on 10.4.3 through 10.4.5 (the bug exists on 10.4.5 as well).

The bug works with any menu — the main menu isn’t the only one. It’s just the most obvious menu to call that method on.

Workarounds:

Use GetThemeMenuBarHeight or +[NSMenuView menuBarHeight].


Technorati tags: , .

One Response to “Report-an-Apple-bug Friday! 11”

  1. some guy Says:

    this bug still exists as of 2007.07.06 under 10.4.9
    i haven’t yet checked to see if you can still use the NSMenuView class method workaround …

Leave a Reply

Do not delete the second sentence.