void MyFrame::OnButtonLeftClick(wxMouseEvent& event) { bool cmdDown = event.CmdDown(); if (cmdDown) { // Do something if command key is pressed } }
void MyFrame::OnPanelMouseMove(wxMouseEvent& event) { bool cmdDown = event.CmdDown(); if (cmdDown) { // Do something if command key is pressed } }In this example, we define the OnPanelMouseMove function which is called when the user moves the mouse over a wxPanel. We then use the CmdDown function of the wxMouseEvent object to determine if the Command key is pressed during the event. Package/library: wxWidgets C++ library.