MaskedTextBox - Time

Apr 22, 2011 at 9:18 PM

Brian,

Thanks for the great toolkit. For a noobie learning WPF, it is very valuable.

I am attempting to use the masked text box for the purpose of entering time. the format is hh:mm:ss. I want the data entry to operate calculator style, right to left. In this way, each of the filed (hh,mm,ss) are theoretically optional. Just type in the value, and go.

In the simplest form, it looks like this:

<extToolkit:MaskedTextBox Mask="00:00:00" Margin="25" Watermark="Enter Value" FlowDirection="LeftToRight" />

When the control is clicked in, the caret appears at the location where the click occurred. If there is no valid data in the control, the I want the caret (and the focus) to appear at the right end of the field.

Additionally, as data is entered, the caret continuously moves to the zeroth position of the string, which is clearly wrong. ;-)

I have not been able to discover anything related to these items in my searching.

Thoughts?

Thanks.

Apr 22, 2011 at 9:26 PM

Currently the MaskedTextBox does not function the way you would like.  You would need to download the source and modify it to fit your needs.  As for the second issue, I cannot duplicate the caret jumping to the front of the string everytime a character is typed.  WHat version of the .NET framework are you using and what version of the toolkit are you using?

Apr 22, 2011 at 9:29 PM

Ah, I see it now.  The code snippet you provided does not have the FlowDirection set propertly.  I changed it to RightToLeft and I am experiencing what you described.  Let me see what I can do.

Apr 22, 2011 at 9:57 PM

I have look ed at every major control vendor including DevExpress, Infragistics, Telerik, and Syncfusion and they all behave the same way when the FlowDirection is set to RightToLeft.  I am not sure this is a bug, although it does seem unnatural.  It may be that it is just a pain in the ass to support that no one bothers.

Apr 23, 2011 at 12:15 AM

Brian,

Thanks for the amazingly fast response. I appreciate and respect your commitment to this project.

My apologies for the error in the original post. I was testing various masks to better understand the functionality, and I clearly left the the last test as LefttoRight. If this example does not convince you, try setting the mask to (000)000-0000, and leave the flow direction right to left. Holy cow!

I appreciate the investigation on your part to better assess the marketplace, and how the other controls behave. As well as you candid response to those behaviors. ;-) While it may be a PITA to do this, I believe that this is a significant problem that should be addressed. You say feature, I say bug. While we may not be able to agree on the categorization, to your point, it IS counter-intuitive. I am working on an application which will use your calculator, which will incorporate the masked edit box to provide a unique calculator for time (details beyond the scope of this thread).

While I could concede the behavior of the initial entry into the field for the clisk event, the placement of the caret is a show-stopper. Whether you spend more time on it, or I do, the behavior will have to change to meet my requirements. And - it would clearly provide you with a competitive advantage over the others you cite! ;-) If you had bought in to their feature sets, I assume you would not have undertaken this endeavor...

Thanks again for an awesome piece of work.

 

Apr 23, 2011 at 1:24 AM

I agree, it is confusing and awkward.  I did take a little time to try to think of a way to correct this behavior, but it turns out to be no simple task.  I will try to think of a solution, but no promises.  If you by chance come up with a solution before I do, please share it :0).

Apr 23, 2011 at 1:26 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.