wxMenu.FindItem(...) can't find items with "_" character

Hello,

Sample code:

   [...]
   menu = wxMenu(...
   menu.Insert(0, 100, "the_name")
   [...]

And this:

   menu.FindItem("the_name")

returns -1 instead of 100. Everything is ok if item label contains no "_"
characters. I'm wondering if this is a bug in WX or I've misunderstood
something.

Using wxPython 2.4.0.8 from debian unstable.

Martynas Jocius

···

--
There is more vision than meets the eye.
http://mjoc.sig.lt

returns -1 instead of 100. Everything is ok if item label contains no "_"
characters. I'm wondering if this is a bug in WX or I've misunderstood
something.

Try "escaping" the with an extra underscore. (menu.FindItem("the__name")). Does that work?

Martynas Jocius wrote:

Hello,

Sample code:

   [...]
   menu = wxMenu(...
   menu.Insert(0, 100, "the_name")
   [...]

And this:

   menu.FindItem("the_name")

returns -1 instead of 100. Everything is ok if item label contains no "_"
characters. I'm wondering if this is a bug in WX or I've misunderstood
something.

The underscore is used in the menu items in gtk the same as the & is used on MSW, it designates which character is the menu item's mnemonic. I would have expected FindItem to work around this difference and do the right thing so please enter a bug report about it.

···

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