How to set a wx.textctrl can editable or readonly?

Tim Chase python.list at tim.thechases.com
Thu Jan 19 10:44:25 EST 2006


>> Additionally, you should be able to copy text from a
>> read-only control, so ousting the focus may not be quite the
>> right thing to do.
> 
> Good point. Alternative approaches would be to trap
> EVT_KEY_DOWN or EVT_TEXT to detect and block attempts to
> modify the contents of the control.

Other complications come if your controls try to second-guess you 
when it comes to copy&paste.  With the keyboard, you want to be 
able to copy, but not paste.  Likewise, in Win32, textboxes and 
comboboxes (not combo-list boxes) allow you to right click on 
them to get a context menu, an option of which is "paste", which 
can put all sorts of bogus data in the field if not intercepted 
properly.  Within X environments, middle-click-to-paste may also 
be a problem.  I don't know if either case applies to wx widgets, 
but it's something I've banged my head against in other languages 
on Win32 (VB, in particular) when trying to make a filtered 
(though not R/O) control.

-tim at yetanothertim.com






More information about the Python-list mailing list