Caret Position on Focus

Editors for WPF Forum

Posted 10 years ago by Mike Strobel - Software Engineer, CDC Software
Avatar
I noticed that when I click to focus an empty editor, the caret is not positioned at the beginning of the first input part. For instance, in the "MaskedTextBox Mask" QuickStart (with a Currency mask selected), clicking anywhere to the right of the input parts results in the caret being shown at the end of the input area. Yet, entering a character causes the caret to jump to the beginning. I believe the caret placement should work like this:

if cursor is over an editor part with some value
then focus that part

else if cursor is between two parts, both with values
then focus the nearest part

else if parts adjacent to cursor have no values but any preceding part has a value
then focus the part following the nearest preceding part that has a value

else focus the first part

At the very least, I think it makes sense to move the caret to the first part if the entire editor is empty. The fact that the first character typed may cause the caret to jump positions from the end to the beginning seems confusing.

Regards,
Mike

[Modified at 03/11/2009 03:50 PM]

Comments (5)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Good point Mike, will work on this today.


Actipro Software Support

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I've updated the MaskedTextBox, so that when you click the caret will be moved to the first edit position without a character (e.g. where input is required). The only exception is if you click on existing input, then it will function like a normal TextBox. So basically, the change only affects clicking in an area without any input.

The parts-based editors should already move the caret to the nearest part. You mentioned MaskedTextBox, but then talk about parts later. So I wasn't sure if those were two different issues or the same one. :-)


Actipro Software Support

Posted 10 years ago by Mike Strobel - Software Engineer, CDC Software
Avatar
Sounds great :). I was a bit confused earlier when I mentioned parts, forgetting that the MaskedTextBox doesn't use them. It sounds like you've got all your bases covered. I'll follow up if I find any other selection issues.

Thanks!
Posted 10 years ago by Mike Strobel - New York, NY
Avatar
Just noticed another issue related to caret positioning: when I click to the far right of the text in a MaskedTextBox (the one in the "Themes" QuickStart), the caret is always positioned *before* the last character.

Mike
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks Mike, this is fixed now.


Actipro Software Support

The latest build of this product (v2019.1 build 0682) was released 28 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.