List Info

Thread: Focus on an non focusable window




Focus on an non focusable window
user name
2007-11-05 04:06:19
Hi Guys,

I'm writing some kind of property sheet and I noticed that
tabbing
from a wx.TextCtrl to another wx.TextCtrl (which are the
only two
focusable elements on my wx.Frame) leaves a gap in the
focusing.

This is what happens;

Focus on wx.TextCtrl  -> TAB
Focus on something invisible -> TAB
Focus on wx.TextCtrl
Focus on something invisible -> TAB
etc.

This is consistent on wxGTK and wxMSW, I did derive a
wx.Panel to get
a custom text and better click abilities, but AFAIK a
wx.Panel should
not steal the focus.

I read something about a derived method AcceptsFocus and
AcceptsFocusFromKeyboard where you can return False to avoid
focussing
but this does not seem to help.

Are there any other elements in wxWidgets that can have
focus but have
no input? So far I used only wx.Panel, and a spacer in my
sizer, but
nothing else actually.

Regards,
- Jorgen

------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


Re: Focus on an non focusable window
country flaguser name
United States
2007-11-05 12:47:57
Jorgen Bodde wrote:
> Hi Guys,
> 
> I'm writing some kind of property sheet and I noticed
that tabbing
> from a wx.TextCtrl to another wx.TextCtrl (which are
the only two
> focusable elements on my wx.Frame) leaves a gap in the
focusing.
> 
> This is what happens;
> 
> Focus on wx.TextCtrl  -> TAB
> Focus on something invisible -> TAB
> Focus on wx.TextCtrl
> Focus on something invisible -> TAB
> etc.
> 
> This is consistent on wxGTK and wxMSW, I did derive a
wx.Panel to get
> a custom text and better click abilities, but AFAIK a
wx.Panel should
> not steal the focus.
> 
> I read something about a derived method AcceptsFocus
and
> AcceptsFocusFromKeyboard where you can return False to
avoid focussing
> but this does not seem to help.


You need to derive from wx.PyPanel for these C++ virtual
method calls to 
be reflected to the Python method, but as you guessed the
default 
behavior for a panel is to not take the focus if it has a
child it can 
pass it on to instead.

> 
> Are there any other elements in wxWidgets that can have
focus but have
> no input? So far I used only wx.Panel, and a spacer in
my sizer, but
> nothing else actually.

Try making a timer whose handler prints the value of 
wx.Window.FindFocus() and see what it prints when your focus
is not 
where you expect it to be.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java
give you jitters?  Relax with wxPython!


------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


Re: Focus on an non focusable window
user name
2007-11-06 06:07:13
Hi Robin,

It seems the wx.Panel does get the focus because I added a
EVT_GET_FOCUS and colored the background red, and the panel
responsible got red. The panel had no other controls, only a
custom
evt_paint.

Thanks for the tip about using wx.PyPanel I will see if that
prevents
the panel from stealing the focus..

Regards,
- Jorgen

On 11/5/07, Robin Dunn <robinalldunn.com> wrote:
> Jorgen Bodde wrote:
> > Hi Guys,
> >
> > I'm writing some kind of property sheet and I
noticed that tabbing
> > from a wx.TextCtrl to another wx.TextCtrl (which
are the only two
> > focusable elements on my wx.Frame) leaves a gap in
the focusing.
> >
> > This is what happens;
> >
> > Focus on wx.TextCtrl  -> TAB
> > Focus on something invisible -> TAB
> > Focus on wx.TextCtrl
> > Focus on something invisible -> TAB
> > etc.
> >
> > This is consistent on wxGTK and wxMSW, I did
derive a wx.Panel to get
> > a custom text and better click abilities, but
AFAIK a wx.Panel should
> > not steal the focus.
> >
> > I read something about a derived method
AcceptsFocus and
> > AcceptsFocusFromKeyboard where you can return
False to avoid focussing
> > but this does not seem to help.
>
>
> You need to derive from wx.PyPanel for these C++
virtual method calls to
> be reflected to the Python method, but as you guessed
the default
> behavior for a panel is to not take the focus if it has
a child it can
> pass it on to instead.
>
> >
> > Are there any other elements in wxWidgets that can
have focus but have
> > no input? So far I used only wx.Panel, and a
spacer in my sizer, but
> > nothing else actually.
>
> Try making a timer whose handler prints the value of
> wx.Window.FindFocus() and see what it prints when your
focus is not
> where you expect it to be.
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org 
Java give you jitters?  Relax with wxPython!
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
> For additional commands, e-mail:
wxPython-users-helplists.wxwidgets.org
>
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )