Search code examples
c++wxwidgets

How to set keyboard focus to NULL window in wxWidgets?


In WinAPI you can call global function SetFocus(HWND) to set focus to NULL window (keystrokes are ignored):

::SetFocus(NULL);

wxWidgets have wxWindow::SetFocus(void) virtual member function so you cannot pass NULL. How to do portable equivalent of ::SetFocus(NULL) in wxWidgets?


Solution

  • There is no way to do it in wxWidgets API (but then it's not clear why would anybody want to do it).

    You can ignore all keys by checking for the corresponding events in wxApp::FilterEvent() if you need to do it globally.