void MyFrame::OnUpdateSave(wxUpdateUIEvent& event) { bool isEnabled = isDocumentSaved(); // check if document is saved event.Enable(isEnabled); // enable the "Save" option if document is saved } // In the constructor: wxMenu* fileMenu = new wxMenu; fileMenu->Append(wxID_SAVE, "&Save\tCtrl+S"); Connect(wxID_SAVE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MyFrame::OnUpdateSave));
void MyFrame::OnUpdateCopy(wxUpdateUIEvent& event) { bool isEnabled = hasTextSelected(); // check if any text is selected event.Enable(isEnabled); // enable the "Copy" button if text is selected } // In the constructor: wxToolBar* toolbar = CreateToolBar(); toolbar->AddTool(wxID_COPY, "Copy", wxArtProvider::GetBitmap(wxART_COPY)); Connect(wxID_COPY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MyFrame::OnUpdateCopy));Package/library name: wxWidgets.