Discussion:
Creating a window that does not accept focus
Paul Young
2014-06-30 12:31:51 UTC
Permalink
WX : 3.0.1
OS : Windows 8.1
COMPILER: VC12 IDE

I have a window which contains some sizers and some static text. I
would prefer that it never accept focus.

I added the following to my wxFrame subclass:


bool AcceptsFocus() const { return false; }
bool AcceptsFocusRecursively() const { return false; }
bool AcceptsFocusFromKeyboard() const { return false; }

It had no effect as far as I can tell. I also tried it in
the minimal sample and it had no effect.

Should this work? Is there some other way to do this?

Paul
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-06-30 14:59:52 UTC
Permalink
On Mon, 30 Jun 2014 08:31:51 -0400 Paul Young wrote:

PY> I have a window which contains some sizers and some static text. I
PY> would prefer that it never accept focus.

If it's a wxPanel it should already work correctly, in theory.

PY> I added the following to my wxFrame subclass:
PY>
PY> bool AcceptsFocus() const { return false; }
PY> bool AcceptsFocusRecursively() const { return false; }
PY> bool AcceptsFocusFromKeyboard() const { return false; }
PY>
PY> It had no effect as far as I can tell. I also tried it in
PY> the minimal sample and it had no effect.
PY>
PY> Should this work?

Overriding just AcceptsFocus() should be enough in principle. If you can
reproduce this in the minimal sample with as small amount of code as
possible, please open a Trac ticket for this (please also mention how
exactly do you give focus to it -- just by clicking it?).

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Continue reading on narkive:
Loading...