Description: wxKeyEvent ControlDown is a method that checks whether the Ctrl key is pressed down during a keyboard event.
Code example 1: Checking if Ctrl key is pressed down during key event
void MyFrame::OnKeyDown(wxKeyEvent &event) { if (event.ControlDown()) { // Ctrl key is pressed down } else { // Ctrl key is not pressed down } }
In this example, the OnKeyDown event is triggered when a key is pressed down. The ControlDown method of wxKeyEvent is then used to check if the Ctrl key is also pressed down.
Code example 2: Changing the key event behavior when Ctrl key is pressed down
void MyFrame::OnKeyDown(wxKeyEvent &event) { if (event.ControlDown()) { // Change the behavior of the key event when Ctrl key is pressed down if (event.GetKeyCode() == WXK_F) { // Do something when Ctrl+F is pressed down } } else { // Normal behavior of the key event } }
In this example, the behavior of the key event is changed when the Ctrl key is pressed down. Specifically, if Ctrl+F is pressed down, then something else happens instead of the normal behavior of the key event. The GetKeyCode method of wxKeyEvent is used to get the code of the key that is pressed down.
C++ (Cpp) wxKeyEvent::ControlDown - 30 examples found. These are the top rated real world C++ (Cpp) examples of wxKeyEvent::ControlDown extracted from open source projects. You can rate examples to help us improve the quality of examples.