Focus vs. Activation

crjjrc crjjrc at gmail.com
Mon Aug 6 05:57:07 PDT 2007


On Aug 3, 11:16 am, va... at wxwidgets.org (Vadim Zeitlin) wrote:

> c> Thanks.  Your explanation helped me figure out a problem where I did
> c> need to set focus.  We had a wxMiniFrame composing a periodic table of
> c> the elements.  The user could "click" a button by typing the atomic
> c> symbol or by clicking on it with the mouse.  The first method,
> c> however, failed to work under GTK wx2.8 unless a button had been mouse-
> c> clicked on first.  On Windows and OS X, keyboard clicking worked
> c> immediately, without requiring a mouse click first.  We were able to
> c> fix this under GTK by setting focus on one of the buttons.  Doesn't
> c> make much sense to me, but it works.
>
>  Why doesn't it make sense? For the window to receive the click it must
> have focus.

It doesn't make sense because the wxMiniFrame is activated, yet I
still must click *a button* first.  Clicking on the wxMiniFrame
anywhere else (title bar, background, etc.) doesn't change the focus
at all, and key presses remain ignored.  But as soon as I click a
button with the mouse, the key events are handled.  Furthermore, this
was only the case under GTK; both OS X and Windows handled key presses
without having to "prime" the wxMiniFrame by clicking on a button.

- Chris







More information about the wx-users mailing list