void MyFrame::OnButtonClicked(wxCommandEvent& event) { wxString filename = *(static_castIn this example, we are retrieving the file name that was associated with the button click event and storing it in a wxString variable. We can then use this filename for some further processing. Overall, wxCommandEvent GetClientData is a useful function for working with events that have additional data associated with them.(event.GetClientData())); // Do something with the filename }