LOGIN    REGISTER    YOUR CART

homepage
VisualHint's blog
Jun17

A TimeSpan editor for .Net

It seems there is no TimeSpan editor for .Net. Can you believe it? So when a customer asked me if it was possible to make one with Smart FieldPackEditor.Net, I realized I could fill a gap with a full featured duration editor, based on the flexibility of SFPE. And this is what is coming in version 1.2.

Update: a screencast has been published.

First here is a nice screenshot taken from the updated supplied sample:

You can see the editor in action and a subset of its properties in a PropertyGrid. And here are its features:

  • It can be used standalone, in Smart PropertyGrid or in the DataGridView. In the last case, the column of the grid can have the timespan type, long type for ticks and double type for seconds).
  • Flexible format string:
      • D for days without leading zeros
      • d for days with leading zeros
      • H for hours without leading zeros
      • h for hours with leading zeros
      • M for minutes without leading zeros
      • m for minutes with leading zeros
      • S for seconds without leading zeros
      • s for seconds with leading zeros
      • F (up to 7 times) for ticks as fraction without trailing zeros
      • f (up to 7 times) for ticks as fraction with trailing zeros
      • T (up to 7 times) for standalone ticks without trailing zeros
      • t (up to 7 times) for standalone ticks with trailing zeros
      • ":" for the time separtor
      • Static fields can be added, something like d 'days' H 'hours'
  • Min and Max values can be set.
  • The most significant field has no max value (except as specified by the global max value set), so you can have a value of 24 hours and more if needed.
  • Updown button can be displayed.
  • Nullable (with delete key or checkbox).
  • Auto-incrementation can be switched on (for ex, seconds passing from 59 to 0 will increment minutes, and so on).
  • A new FieldAdded event allows you to modify a field on the fly, for example to change the “day” static string to the plural “days” depending on the current value.

This new editor is a free addition to Smart FieldPackEditor.Net and is planned for release in a few days. A screencast will also be published next week.