how to show selection in disabled TextCtrl?

I have a textctrl that is in a disabled state. From a dialog I want to
be able to highlight the text in that control (think of a
find/replace type dialog). However, because the textctrl is disabled
and doesn't have focus the selection isn't visible. I'm actually
seeing something even worse than that -- it appears the selection sets
the foreground to white, but the background stays white so the text
disappears.

Is there a way to use the selection mechanism to select text in a
textctrl and have the selection visible even when the widget is
disabled and doesn't have focus? Or, is there a method I can use to
explicitly set the selection foreground and background colors? Bottom
line is, I need a way for my dialog to be able to highlight the text
in a disabled textctrl.

This is on a linux system, wxPython version 2.8.9.1 (gtk2-unicode)

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Why not just make the text control read-only? I think the style flag
to pass it is wx.TE_READONLY.

···

On May 20, 11:41 am, Bryan Oakley <bryan.oak...@gmail.com> wrote:

I have a textctrl that is in a disabled state. From a dialog I want to
be able to highlight the text in that control (think of a
find/replace type dialog). However, because the textctrl is disabled
and doesn't have focus the selection isn't visible. I'm actually
seeing something even worse than that -- it appears the selection sets
the foreground to white, but the background stays white so the text
disappears.

Is there a way to use the selection mechanism to select text in a
textctrl and have the selection visible even when the widget is
disabled and doesn't have focus? Or, is there a method I can use to
explicitly set the selection foreground and background colors? Bottom
line is, I need a way for my dialog to be able to highlight the text
in a disabled textctrl.

This is on a linux system, wxPython version 2.8.9.1 (gtk2-unicode)

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,
I believe, using the wx.TE_NOHIDESEL flag for the TextCtrl the
selection should be visible also without focus and in disabled widget.

hth,
  vbr

···

2010/5/20 Bryan Oakley <bryan.oakley@gmail.com>:

I have a textctrl that is in a disabled state. From a dialog I want to
be able to highlight the text in that control (think of a
find/replace type dialog). However, because the textctrl is disabled
and doesn't have focus the selection isn't visible. I'm actually
seeing something even worse than that -- it appears the selection sets
the foreground to white, but the background stays white so the text
disappears.

Is there a way to use the selection mechanism to select text in a
textctrl and have the selection visible even when the widget is
disabled and doesn't have focus? Or, is there a method I can use to
explicitly set the selection foreground and background colors? Bottom
line is, I need a way for my dialog to be able to highlight the text
in a disabled textctrl.

This is on a linux system, wxPython version 2.8.9.1 (gtk2-unicode)

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

That makes no difference in my case. In fact, I misspoke earlier when
I said it was disabled -- we call SetEditable(False). If I remove
that, and whether I use the flag TE_READONLY or not, the problem
persists.

···

On Thu, May 20, 2010 at 12:59 PM, Mike Driscoll <kyosohma@gmail.com> wrote:

On May 20, 11:41 am, Bryan Oakley <bryan.oak...@gmail.com> wrote:

I have a textctrl that is in a disabled state. From a dialog I want to
be able to highlight the text in that control (think of a
find/replace type dialog). However, because the textctrl is disabled
and doesn't have focus the selection isn't visible. I'm actually
seeing something even worse than that -- it appears the selection sets
the foreground to white, but the background stays white so the text
disappears.

Is there a way to use the selection mechanism to select text in a
textctrl and have the selection visible even when the widget is
disabled and doesn't have focus? Or, is there a method I can use to
explicitly set the selection foreground and background colors? Bottom
line is, I need a way for my dialog to be able to highlight the text
in a disabled textctrl.

This is on a linux system, wxPython version 2.8.9.1 (gtk2-unicode)

Why not just make the text control read-only? I think the style flag
to pass it is wx.TE_READONLY.

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

According to the documentation this only affects windows systems. My
observation also shows this has no affect on my linux box.

···

On Thu, May 20, 2010 at 1:10 PM, Vlastimil Brom <vlastimil.brom@gmail.com> wrote:

Hi,
I believe, using the wx.TE_NOHIDESEL flag for the TextCtrl the
selection should be visible also without focus and in disabled widget.

hth,
vbr

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

I'm sorry, I must have totally missed, that you mentioned your
operating system in your initial post. As you can guess, I only tested
it on windows...
I don't know of any other option - of course besides emulating the
"selection" with manually setting the background colour via SetStyle
with an appropriate wx.TextAttr(...) -
on windows the style can be set even for disabled TextCtrls or with
SetEditable(False).

vbr

···

2010/5/20 Bryan Oakley <bryan.oakley@gmail.com>:

On Thu, May 20, 2010 at 1:10 PM, Vlastimil Brom > <vlastimil.brom@gmail.com> wrote:

Hi,
I believe, using the wx.TE_NOHIDESEL flag for the TextCtrl the
selection should be visible also without focus and in disabled widget.

hth,
vbr

According to the documentation this only affects windows systems. My
observation also shows this has no affect on my linux box.

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

What I've done for a related case where I wanted output-only data to
appear like static text but still be selectable is to use the
wx.TE_READONLY and wx.BORDER_NONE flags and set the background color
to match the dialog panel background color. The user can then select/
copy the text as needed. I had to manually figure out the color values
of the dialog panel using GIMP on the various platforms though. I
found that GetBackgroundColour() reported color tuples off by 5 for
Linux and always reported white for Mac OS X (IIRC). White seems to
the default on Windows Vista. On all platforms, the data, when
selected, appears as white text on a blue background.

Dan

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en