Hello,
As asked in the title, how to do so, or simply remove this wxButton from the tab navigation order at all, and allow the focus to be set only by a mouse click.
TIA.
How to prevent a wxButton from gaining the focus by pressing the TAB from the keyboard? Topic is solved
-
- Filthy Rich wx Solver
- Posts: 207
- Joined: Mon Apr 24, 2017 4:23 am
-
- Can't get richer than this
- Posts: 828
- Joined: Mon Apr 30, 2012 11:07 pm
Re: How to prevent a wxButton from gaining the focus by pressing the TAB from the keyboard?
Use mybutton->SetCanFocus(false) See https://docs.wxwidgets.org/trunk/classw ... 66f1b7f3d8
-
- Filthy Rich wx Solver
- Posts: 207
- Joined: Mon Apr 24, 2017 4:23 am
Re: How to prevent a wxButton from gaining the focus by pressing the TAB from the keyboard?
Unfortunately, it didn't worked under Windows 7
-
- Moderator
- Posts: 19163
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Re: How to prevent a wxButton from gaining the focus by pressing the TAB from the keyboard?
The cleanest version would be to subclass wxButton, override wxWindow::AcceptsFocusFromKeyboard() and return false there.
https://docs.wxwidgets.org/trunk/classw ... c6aa8301b8
https://docs.wxwidgets.org/trunk/classw ... c6aa8301b8
Use the source, Luke!