List Info

Thread: HtmlWindow - AcceptsFocus False does not work




HtmlWindow - AcceptsFocus False does not work
user name
2006-05-31 08:58:27
Hi all

A minor issue.

I have an HtmlWindow on the same panel as other controls, to
display some
text. If the user tries to tab across it, it accepts focus,
and they have to
tab again to move on.

I tried subclassing HtmlWindow, and adding
    def AcceptsFocus(self):
        return False

but it made no difference.

I have got around it by adding
    self.Bind(wx.EVT_SET_FOCUS,self.onGotFocus)
    def onGotFocus(self,evt):
        self.Navigate()

It works, but now I have to take into account shift+tab to
move backwards,
so it is getting a bit fiddly.

Should AcceptsFocus() work here? Is it a bug, or am I doing
something wrong?

Thanks for any info.

Frank Millman

PS I will explain the layout in case it is relevant - it is
a bit complex.

Frame
  |
   - Panel
      |
       - SplitterWindow (Horizontal)
               |
                - HtmlWindow
               |
                - SplitterWindow (Vertical)
                        |
                         - Panel (left) with various
controls
|
                        |
                         - Panel (right) with various
controls

Tab from the last control on the left panel must move to the
first control
on the right panel. This works ok.

Tab from the last control on the right panel must move to
the first control
on the left panel. Without my modification, control passes
to the
HtmlWindow.


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

HtmlWindow - AcceptsFocus False does not work
user name
2006-05-31 19:51:04
Frank Millman wrote:
> Hi all
> 
> A minor issue.
> 
> I have an HtmlWindow on the same panel as other
controls, to display some
> text. If the user tries to tab across it, it accepts
focus, and they have to
> tab again to move on.
> 
> I tried subclassing HtmlWindow, and adding
>     def AcceptsFocus(self):
>         return False
> 
> but it made no difference.
> 
> I have got around it by adding
>     self.Bind(wx.EVT_SET_FOCUS,self.onGotFocus)
>     def onGotFocus(self,evt):
>         self.Navigate()
> 
> It works, but now I have to take into account shift+tab
to move backwards,
> so it is getting a bit fiddly.
> 
> Should AcceptsFocus() work here?

Unfortunately, no.  The C++ classes and methods have to be
specially 
instrumented in order to pass virtual method calls down to
classes 
derived from it in Python, and HtmlWindow has only done that
for the 
HtmlWindow methods (OnLinkClicked, etc.) and not the general
wx.Window 
virtuals.


-- 
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

[1-2]

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