Hello,
I'm wondering if there is an easy way to make the date/time "rollover"?
For example, in the editor above, if the user decremented the second, I have SpinWrap set to true so it decrements to 59, but the rest of the time stays the same (i.e. 14:00:59). What I'd like to make it do is decrement the whole time, not just the second portion, so the new value would become 13:59:59. Is there an easy way to do this, or would I have to handle an event and implement this functionality myself?
This is especially important for me with regards to crossing over midnight, since I don't want to show the date in this instance of the control, just the time, but I'd like the date to change if the value crosses over midnight (i.e. if 23:00:00 changes to 00:00:00, I'd like it to be 00:00:00 of the next day, not the same day).
Please let me know how to go about solving this. Thank you!
Awesome, thank you!
Hi,
There is a property to control the dropDown - AllowDropDown. You just have to set it to false, and dropDown button will be hidden like in time mask.
Regards,
Anastas
So it turns out that we will be using a date portion in this control after all, so I'm just going to leave it as the default behaviour and let the users adjust it as they will. I do have one small question connected with this though. Now that the date portion is showing in the control (mask = "yyyy/mm/dd hh:mm:ss") it's also causing the calendar dropdown button to appear, but I'd like to show the spin buttons only. No problem I think, I'll just set the DropDownButtonDisplayMode to "Never" and hide the dropdown in the same way I would normally hide the spin buttons... except that although SpinButtonDisplayMode has a "Never" option, DropDownButtonDisplayMode does not! So my question is, how do I hide the dropdown and just display the spinbuttons, the same as when it's a time-only control?
No there is nothing built in for that. You'd have to do something like hook the ExecutingCommand event and watch for when the e.Command is MaskedEditorCommands.SpinUp or SpinDown. Then you would set e.Handled to true and implement your spinning - likely by getting the current value and manipulating it. You'd probably have to look at the SelectionStart and SelectionLength (since selection could span multiple sections) and enumerate the Sections to find out what section you are in (based on the # of items in the DisplayChars collection) and then determine how much you want to increment the value.
Thank you (both) for the help. This is close to what I want, but I don't want to have to limit it to just one set increment. I'd still like to be able to adjust whatever section that has the caret, but I'd like it to "rollover" like it does with the spinincrement set. Kind of a combination of both systems. Is this possible?