How to add checkmarks to an IPopupMenu when selected?

I have a size menu, but when I click an item, there’s no checkmark added.

std::array<int, 10> view_size_options_ = { 75, 100, 110, 120, 130, 140, 150, 160, 175, 200 };

// Size menu
        m_p_size_menu_ = new IPopupMenu ("Size Menu");
        m_p_size_menu_->Clear();
        WDL_String option_size;
        for (auto i = 0; i < view_size_options_.size(); ++i)
        {
            option_size.SetFormatted (10, "%d%%", view_size_options_[i]);
            m_p_size_menu_->AddItem (option_size.Get());
        }
        m_p_size_menu_->SetFunction ([this] (IPopupMenu* pop)
                                     {
                                         if (pop->GetChosenItem() == nullptr || GetUI() == nullptr)
                                             return;
                                         const int size = view_size_options_[pop->GetChosenItemIdx()];
                                         const float scale = static_cast<float> (size) / 100.f;
                                         GetUI()->Resize (PLUG_WIDTH, PLUG_HEIGHT, scale, true);
                                     });

Any help is appreciated.

When you AddItem() set the kChecked flag. e.g.

If I add the kChecked flag, it adds checkmarks to all of them. I’m trying to make it like the preset manager with the presets when selected they get a checkmark.

for (auto i = 0; i < view_size_options_.size(); ++i)
        {
            option_size.SetFormatted (10, "%d%%", view_size_options_[i]);

            const auto selectedItem = m_p_size_menu_->GetChosenItemIdx();

            if (i == selectedItem)
                m_p_size_menu_->AddItem (option_size.Get(), -1, IPopupMenu::Item::kChecked);
            else
                m_p_size_menu_->AddItem (option_size.Get());

        }
        m_p_size_menu_->SetFunction ([this] (IPopupMenu* pop)
                                     {
                                         if (pop->GetChosenItem() == nullptr || GetUI() == nullptr)
                                             return;
                                         const int size = view_size_options_[pop->GetChosenItemIdx()];
                                         const float scale = static_cast<float> (size) / 100.f;
                                         GetUI()->Resize (PLUG_WIDTH, PLUG_HEIGHT, scale, true);
                                     });

        // Setup main popup menu
        setting_menu_ = new IPopupMenu ("[root]");
        setting_menu_->AddItem (new IPopupMenu::Item ("Window Size", m_p_size_menu_));

I don’t know if it makes it more clear what I’m trying to accomplish

You can also use IPopupMenu->CheckItemAlone(itemIndex). here is an example

(EDIT - updated with a simpler example)

Thank you for all your help and guidance @olilarkin, it’s greatly appreciated.