Menu Bar Model Ticks

Hi,

I am using a native mac menu and I want one of the popup menus items to change whether it is ticked on not when it is clicked. So far I have this:

    PopupMenu MainComponent::getMenuForIndex(int topLevelMenuIndex, const String &menuName)
{
    PopupMenu menu;
    
    //Settings Menu
     if(topLevelMenuIndex == 0)
    {
        menu.addItem(1, "Change Filename with Title", true, changeFileNameWithTitle);
    }
    
    return menu;
}

void MainComponent::menuItemSelected(int menuItemID, int topLevelMenuIndex)
{
    if(topLevelMenuIndex == 0)
    {
        if(menuItemID == 1)
        {
            //Inverses the bool
            changeFileNameWithTitle = !changeFileNameWithTitle;
            fileTable.setChangeFilenamewithTitle(changeFileNameWithTitle);
        }
    }
}

The problem is the getMenuForIndex() is called only on initialisation and so the visual tick does not change when the bool variable is changed.

Any suggestions?

Check out menuItemsChanged() in the MenuBarModel class. You should call this when any menu items have changed, to rebuild the menu.

Thank you so much. I have no idea how I missed that!