Currently I'm using the wx.TE_READONLY style, which prevents the user
from selecting the text, but if they click on the text their cursor
appears inside the text.
Is it possible prevent this behavior?
Here's how I'm constructing it currently:
wx.TextCtrl(self, -1, "testing", size = (150, 17), style=wx.TE_RICH2
| wx.NO_BORDER | wx.TE_CENTRE | wx.TE_READONLY)
If you're using Windows, you can see the behavior by trying the
program I'm working on:
http://gizmoware.net/triggerfinger
Click on one of the captions under one of the buttons.
As I understand it, TE_READONLY just makes the text control read-only,
which means the user can still select the text so that they can copy
and paste it. They just can't edit the text in the control.
There are two ways to prevent the user from getting a cursor in there
(I think):
1) Bind the control to the EVT_SET_FOCUS and cancel it
2) Disable the widget (probably the best solution)
-------------------
Mike Driscoll
Focus events are not veto-able, but what you can do is call Navigate so
the focus will be moved to the next widget in the tab-order, or
explicitly call SetFocus on some other widget if you want it to go to
some specific place.
> 2) Disable the widget (probably the best solution)
Yes, but that changes the appearance of the widget, which may not be
desired.
--
Robin Dunn
Software Craftsman
http://wxPython.org
On Mar 25, 4:46 pm, Robin Dunn <ro...@alldunn.com> wrote:
> On 3/25/10 7:22 AM, Mike Driscoll wrote:
>
> > As I understand it, TE_READONLY just makes the text control read-only,
> > which means the user can still select the text so that they can copy
> > and paste it. They just can't edit the text in the control.
>
> > There are two ways to prevent the user from getting a cursor in there
> > (I think):
>
> > 1) Bind the control to the EVT_SET_FOCUS and cancel it
>
> Focus events are not veto-able, but what you can do is call Navigate so
> the focus will be moved to the next widget in the tab-order, or
> explicitly call SetFocus on some other widget if you want it to go to
> some specific place.
>
I didn't know that...oops! I meant basically the same thing though
(i.e. SetFocus on a different widget)
> > 2) Disable the widget (probably the best solution)
>
> Yes, but that changes the appearance of the widget, which may not be
> desired.
>
> --
> Robin Dunn
> Software Craftsmanhttp://wxPython.org
Yeah, but I couldn't think of a different way other than Disabling the
widget or just using a StaticText.
--
To unsubscribe, send email to wxPython-user...@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
To unsubscribe from this group, send email to wxpython-users+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.