wxMenuItem.IsChecked

From: Robin Dunn <robin@alldunn.com>
David Montgomery wrote:
> Hi,
>
> In my handler for a wx.ITEM_CHECK menu item,
> I'm looking up the menu item and calling item.IsChecked.
> My intent was to use the returned value as an indication
> of whether the checked item was just turned on, or just
> turned off.
>
> What I see, however, is that item.IsChecked is always
> returning False.
>
> (The menu item itself does toggle between showing and not
> showing a check.)
>
> Is this expected behavior? Is there some other recommended
> way to get whether the item is becoming checked or
> unchecked?

Try menuBar.IsChecked(menuItem.GetId())

The menu items are not kept up to date with the state of the menu, but
are more for use of creating menus or for a holding place when fetching
the current state of an item from a menu.

Thanks for the suggestion.

Alas, I tried this, and menuBar.IsChecked is also always
returning False, regardless of the visual state of the check.

It's not such a big deal -- I have things working by keeping
the toggle state in my own variable. But if you have any other
suggestions, I would be glad to try them.

David