Problems with MinimumDate / MaximumDate properties of DateTimeCellType

Posted by: andreas-seibt on 8 September 2017, 1:55 pm EST

  • Posted 8 September 2017, 1:55 pm EST

    Hello,

    i try to  limit the user input for a DateTime cell with the MinimumDate / MaximumDate properties:

            Dim ct As DateTimeCellType = CType(sprMonate_Sheet1.Columns(0).CellType, DateTimeCellType)
            ct.MinimumDate = new Date(2006,10,1)
            ct.MaximumDate = new Date(2007,9,30)

    Now i want to enter 01.11.2006 (german date format) in a date cell. When the editor gots the focus, immedieatly the max. date (30.09.2007) is displayed. I can overwrite the day part, but overwriting the month part is inhibited by the editor until i overwrite the year part. Without the limits i can enter the date value without problems. How can i prevent, that the maximum date is displayed a default value when i enter a cell?

     

    Regards

    Andreas Seibt

  • Replied 8 September 2017, 1:55 pm EST

    i tried to set the DateDefault property to the MinimumDate value. This works as long as i enter dates with a month larger than the month of the minum date.

     

    Regards

    Andreas Seibt

  • Replied 8 September 2017, 1:55 pm EST

    Andreas,


    This is correct behavior. The DateTimeCellType will format the date as you are typing it, so you can not ever have an invalid date in the cell.

  • Replied 8 September 2017, 1:55 pm EST

    i understand, but when a default date is displayed when i start typing, i first have to edit the year or month part of the date to satisfy range check. This is a very ugly user experience specially for a german user as we enter a date in the order day, month, year. I except. that the min / max date is verified when the user leaves the cell. As you say that the current behavior is the intended one, i can't use this feature and i'm afraid i have to implement the date check for myself.

     Regards

    Andreas Seibt


  • Replied 8 September 2017, 1:55 pm EST

    Andreas,


    I wanted to also let you know that the way validating dates as the user is typing is changing for version 5 of the product and will be a better experience for the developer and user.

  • Replied 8 September 2017, 1:55 pm EST

    Andreas,


    You can remove the Formatter on the editor of the CellType to remove this behavior.


     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Dim d As New custDate
      d.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.UserDefined
      d.UserDefinedFormat = "dd.MM.yyyy"
      FpSpread1.Sheets(0).Cells(1, 1).CellType = d
      FpSpread1.EditModeReplace = True
     End Sub



    Public Class custDate
     Inherits FarPoint.Win.Spread.CellType.DateTimeCellType
     Public Overrides Function GetEditorControl(ByVal appearance As FarPoint.Win.Spread.Appearance, ByVal zoomFactor As Single) As System.Windows.Forms.Control
      Dim dtEditor As FarPoint.Win.Spread.CellType.GeneralEditor  = MyBase.GetEditorControl(appearance, zoomFactor)
      dtEditor.Formatter = Nothing
      Return dtEditor
     End Function
    End Class


     

  • Replied 8 September 2017, 1:55 pm EST

    Finally i found time to implement the custom date format. Is there any way to add my custom format to the CellType ComboBox in the NamedStyle-Editor?

     

    Regards

    Andreas

  • Replied 8 September 2017, 1:55 pm EST

    Andreas,


    I am not sure exactly what you are asking for. There is not a way to assign a custom celltype class in the NameStyle Collection Editor. However, I am not sure what you are looking to do to add this format to a custom combobox celltype.

  • Replied 8 September 2017, 1:55 pm EST

    What i'm asking for is if there is a way to integrate custom celltypes into Farpoint Spread in a way that they can be used in the Spread designer.
  • Replied 8 September 2017, 1:55 pm EST

    Andreas,

    Please note that custom cell types are generated at run time and there is not a provision available to add a custom cell type to the Spread Designer.

    Thanks

  • Replied 8 September 2017, 1:55 pm EST

    i urgently need a hint how to disable the date check. There is a general error in the automatic validation when i enter dates in the german format (day / mont / year). Following scenario:

    Empty cell with column.CellType = DateTime

    Want to enter 31.10.2006

    start editing -> cell value is automatically set to  09.06.2009 ->

    enter 31 -> value is automatically corrected to 30 (as june just have 30 days) ->

    enter 102006 to complete the date input ->

    go back to the day part and correct the value from 30 to 31

    <b>This is an absolutely NOGO for our application</b>.

    There are many spreads with date / time columns as the application makes heavy use of timelines. We can't expect from our users that they accept this unconventional behavior.

    If you can't present a solution for this problem, we have to look for another spread control.

    Regards

    Andreas Seibt

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels