cbeytas wrote:
> Right. It works if I do:
> start, stop = textCtrl.GetSelection()
> textCtrl.Replace(start, stop, upper_char)
> event.Skip(False)
>
> I'm not confident that would cover all possible cases, cross-platform.
I don't really feel like modifying key events is what you want to do
here. Your goal - have all text in a wx.TextCtrl be uppercase. So what
happens when a user pastes text into the control or you set the contents
programmatically? You'll end up with a mix of upper and original case text.
Instead, it would probably be better to bind a wx.EVT_TEXT handler and,
when the text in the control is changed, convert the whole thing to
uppercase, restoring the selection if necessary. See this Stack
Overflow question for an example:
https://stackoverflow.com/questions/1241942/wxpython-textctrl-transform-to-uppercase
--
James Scholes
http://twitter.com/JamesScholes