I'm trying to use a wx.TextCtrl the way a wx.StaticText would normally
be used, meaning read only, and non selectable. In other words, if the
user clicks on the control, no cursor should appear.
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.
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)
···
On Mar 25, 7:14 am, wrybread <wrybr...@gmail.com> wrote:
I'm trying to use a wx.TextCtrl the way a wx.StaticText would normally
be used, meaning read only, and non selectable. In other words, if the
user clicks on the control, no cursor should appear.
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.
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.
2) Disable the widget (probably the best solution)
Yes, but that changes the appearance of the widget, which may not be desired.
> 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.
···
On Mar 25, 4:46 pm, Robin Dunn <ro...@alldunn.com> wrote:
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.
I would also like to have textctrl without focus, and then I thought of using StaticText but I wish he had defined edges.
On Dec 22, 3:21 am, Fabio Spadaro <fabiolinos...@gmail.com> wrote:
Hi all,
2010/3/26 Mike Driscoll <kyoso...@gmail.com>
> 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.