I’m using an NSMenuMBS with a searchfield and have a populated menu list associated with it. When the menu selection changes I want to remove the check from other options and place it next to the selected option. I can do that with
menuItem.state = 1
However, the menu doesn’t update to show the check. I know it’s set correctly because if I clear them Recent items in the menu the check shows up.
My question is, how do I force the menu to update all items so that the checks are removed/applied properly? myMenu.Update doesn’t do it.
Thanks, but that’s not it. I can check an item when the menu is constructed and it shows. And as I said I can check a different item when a different menuitem is selected – but it doesn’t show as checked unless I do something like Clear the Recent menu, then the check shows up. I’m guessing that Clear forces an update, but I don’t know how to do that programmatically.
After some sleuthing in Stack Overflow I thought the problem was that you need to use the validateMenuItem event. In fact, in the MBS docs it says
Function: Implemented to override the default action of enabling or disabling a specific menu item. Notes:
Return true to enable menuItem, false to disable it.
This is needed to modify the menuitem for a menu attached to a NSSearchFieldMBS.
However, I added the validateMenuItem event and return True, but the check still doesn’t appear dynamically.