Re: Auto-select text in editbox

Author: Barbara Peisch

Posted: 2001-10-09 at 20:48:18

> GotFocus() method:

> this.SetFocus()

Careful with that. If you've gotten to this textbox via a Valid method

anywhere up the chain, that will barf on you. Instead, just put Dodefault()

in the GotFocus method. I also only call Dodefault if SelectOnEntry is .T.

That still won't work when you click in the textbox if it's in a grid,

though. So, in the Click method, I put this code:

If This.parent.class = "Column" and this.SelectOnEntry = .T.

Dodefault()

This.SelStart = 0

This.SelLength = 999

Nodefault

Endif

Of course, if your textbox is wider than 999, you'd have to increase the

setting of SelLength.

-BP

www.peisch.com

©2001 Barbara Peisch