Read-only TextCtrl not appearing in tab order inside SizedDialog

Hi all,

I'm creating a subclass of wx.lib.sized_controls.SizedDialog containing
some TextCtrls and a standard button sizer, but for some reason, any
control that has the wx.TE_READONLY style flag set doesn't appear to be
a part of the tab order inside the dialog. I can set focus to such a
control by clicking on it or using its associated mnemonic, but as soon
as I tab away from it, I can't tab back.

I've attached a sample, dialog_sample.py, which demonstrates the
problem. First, notice that you can tab to the editable field, type
some text, and it then appears in the second, which is set to be
read-only. You can press Alt+N to jump keyboard focus to the read-only
control, but otherwise, you cannot set focus to it using the keyboard.

OS: Windows 7 Professional, 64-bit
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit
(Intel)] on win32
wxPython 3.0.3.dev1830+0b5f910

Apologies if the size of the sample dialog doesn't permit you to see it
clearly - I'm visually impaired so just used the default, initial size.

Many thanks.

dialog_sample.py (1.33 KB)

···

--
James Scholes
http://twitter.com/JamesScholes

Hi James,
I confirm this (some time ago I posted the same question, btw). I
would like to get an answer, but if you need to handle this really
fast, here is a work-around:
set your field as TE_MULTILINE even if you don't need to be so. Then
it gets focusable. Don't know why, but it is so.
P.S. The world is small :slight_smile:

···

--
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: @m_elensule; Facebook: menelion
My blog: http://menelion.oire.org/

------------ Original message ------------
From: James Scholes <james@jls-radio.com>
To: wxpython-users@googlegroups.com
Date created: , 11:06:09 PM
Subject: [wxPython-users] Read-only TextCtrl not appearing in tab order inside SizedDialog

      Hi all,

I'm creating a subclass of wx.lib.sized_controls.SizedDialog containing
some TextCtrls and a standard button sizer, but for some reason, any
control that has the wx.TE_READONLY style flag set doesn't appear to be
a part of the tab order inside the dialog. I can set focus to such a
control by clicking on it or using its associated mnemonic, but as soon
as I tab away from it, I can't tab back.

I've attached a sample, dialog_sample.py, which demonstrates the
problem. First, notice that you can tab to the editable field, type
some text, and it then appears in the second, which is set to be
read-only. You can press Alt+N to jump keyboard focus to the read-only
control, but otherwise, you cannot set focus to it using the keyboard.

OS: Windows 7 Professional, 64-bit
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit
(Intel)] on win32
wxPython 3.0.3.dev1830+0b5f910

Apologies if the size of the sample dialog doesn't permit you to see it
clearly - I'm visually impaired so just used the default, initial size.

Many thanks.
--
James Scholes
http://twitter.com/JamesScholes

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi James,

···

On 9/9/2015 22:06, James Scholes wrote:

Hi all,

I'm creating a subclass of wx.lib.sized_controls.SizedDialog containing
some TextCtrls and a standard button sizer, but for some reason, any
control that has the wx.TE_READONLY style flag set doesn't appear to be
a part of the tab order inside the dialog. I can set focus to such a
control by clicking on it or using its associated mnemonic, but as soon
as I tab away from it, I can't tab back.

I've attached a sample, dialog_sample.py, which demonstrates the
problem. First, notice that you can tab to the editable field, type
some text, and it then appears in the second, which is set to be
read-only. You can press Alt+N to jump keyboard focus to the read-only
control, but otherwise, you cannot set focus to it using the keyboard.

OS: Windows 7 Professional, 64-bit
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit
(Intel)] on win32
wxPython 3.0.3.dev1830+0b5f910

Apologies if the size of the sample dialog doesn't permit you to see it
clearly - I'm visually impaired so just used the default, initial size.

Many thanks.

I am pretty sure this is standard behaviour for a TextCtrl with the TE_READONLY style. I can see that this is a problem if you use a screen reader. Maybe open an issue on the wxWidgets trac: http://trac.wxwidgets.org/

Werner

James Scholes wrote:

I'm creating a subclass of wx.lib.sized_controls.SizedDialog containing
some TextCtrls and a standard button sizer, but for some reason, any
control that has the wx.TE_READONLY style flag set doesn't appear to be
a part of the tab order inside the dialog. I can set focus to such a
control by clicking on it or using its associated mnemonic, but as soon
as I tab away from it, I can't tab back.

This is by design, and it's a Windows thing, not a wx thing. A
read-only control cannot receive any input, so there is no need to
include it in the tab order.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts wrote:

A read-only control cannot receive any input, so there is no need to
include it in the tab order.

Understandable (I suppose) but wx.TextCtrls with the wx.TE_MULTILINE
flag set don't exhibit this behaviour. The world of keyboard
accessibility sure is full of inconsistencies...

···

--
James Scholes
http://twitter.com/JamesScholes

Ah, well, it might be used to show text - based on values in
other fields - to be used for copy/paste. So it depends.

Karsten

···

On Fri, Sep 11, 2015 at 01:19:10AM +0100, James Scholes wrote:

Tim Roberts wrote:
> A read-only control cannot receive any input, so there is no need to
> include it in the tab order.

--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Karsten Hilbert wrote:

Ah, well, it might be used to show text - based on values in
other fields - to be used for copy/paste. So it depends.

That's exactly what I'm using it for, so I don't really buy that this
isn't a bug. I'll report it at some stage unless it's Windows API
behaviour.

···

--
James Scholes
http://twitter.com/JamesScholes