How to handle click-event on dynamic ToolStripMenuItem c++

214 views Asked by At

Now I need to handle click-event each dropdownitems from ToolStripMenuItem (named "hetToolStripMenuItem") my dropdownitems is dynamic from file that I loaded to my program. I try to find solutions but it didn't work with my program. Can anyone help, explain or give me some keyword to fixed my problems.

    private:
    System::Void setHetComponents() {
        this->hetToolStripMenuItem->DropDownItems->Clear();
        for(int i=0;i<pdbdata->GetHetListsNum();i++){
            String^ getHetLsit = gcnew String(pdbdata->GetHetLists(i).c_str());
            T1 = gcnew ToolStripMenuItem(getHetLsit);
            T1->Name = getHetLsit;
            hetToolStripMenuItem->DropDownItems->Add(T1);
        }
     }

Some declared components

private: System::Windows::Forms::ToolStripMenuItem^  hetToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  T1;
0

There are 0 answers