[IronPython] focus and selecting text in a TextBox with IronPython
fuzzyman at voidspace.org.uk
Thu Mar 25 20:44:09 CET 2010
On 25/03/2010 19:33, Ken MacDonald wrote:
> On Wed, Mar 24, 2010 at 7:27 PM, Ken MacDonald <drken567 at gmail.com
> <mailto:drken567 at gmail.com>> wrote:
> Using WPF. I'll give the Start/Length a try....
> 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.
Can you repeat your requirements, I'll try to suggest some code.
> def guest_name_keyboard_focus(self, sender, args):
> print("got focus!")
> textbox = self.control("NewGuestName")
> textbox.SelectionStart = 0
> textbox.SelectionLength = len(textbox.Text)
> #textbox.Cut() <=== works if un-commented
> Users mailing list
> Users at lists.ironpython.com
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users