开发者

XtraEditors.TextEdit: How to Set Cursor Starting Index When the EditMask Value is Given

I have a DevExpress.XtraEditors.TextEdit control.

And I set the EditMask value to (\d?\d?\d?)\d\d\d-\d\d\d\d for a phone number input.

My problem is that when the user doesn't cl开发者_Go百科ick on the very left of TextEdit, cursor doesn't start typing from the beginning.

Is there a way that I could set the starting index of cursor?

I tried to do something from _MouseClick event but wasn't be able to find anything.

Thanks in advance.


You have this tagged as asp.net but you mention DevExpress.XtraEditors.TextEdit which is WinForms?? which is it?

If it is for Winforms I believe you can handle the GotFocus event then do myTextEdit.Select(0, 0)

Unfortunately the way that the Mouse events fire you may if you click still end up selecting a point somewhere in the middle of the result, you could handle the MouseUp event and put the TextEdit1.Select(0, 0) there as well but that would stop the users from being able to put the cursor in the middle of the text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜