[IronPython] focus and selecting text in a TextBox with IronPython

Ken MacDonald drken567 at gmail.com
Thu Mar 25 20:33:58 CET 2010


On Wed, Mar 24, 2010 at 7:27 PM, Ken MacDonald <drken567 at gmail.com> wrote:

> Hi,
> Using WPF. I'll give the Start/Length a try....
> Ken
>
> OK, I tried that in various flavors, still not working. The selection
itself appears to be working; if I un-comment the "Cut()" at the end, I
click into the box and the existing text disappears. Without the Cut(), if I
click into the box, the caret appears at the end of the existing text, the
text is NOT highlighted (as in Ctrl-A, which works fine), and typing just
appends to the existing text. Any clues appreciated. I've been trying to get
this working for several days now, and everything I've found seems to
indicate this should work.
Ken


>     def guest_name_keyboard_focus(self, sender, args):
>         print("got focus!")
>         textbox = self.control("NewGuestName")
>         #textbox.SelectAll()
>         textbox.Focus()
>         textbox.SelectionStart = 0
>         textbox.SelectionLength = len(textbox.Text)
>


>         #textbox.Cut()   <=== works if un-commented
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100325/a0c35f77/attachment.html>


More information about the Ironpython-users mailing list