Performance regression in "C1.Win.Calendar.C1DateEdit"

Posted by: wknauf on 18 November 2019, 8:54 pm EST

    • Post Options:
    • Link

    Posted 18 November 2019, 8:54 pm EST

    Hi C1,

    is seems a performance regression was introduced in recent builds: if a form contains several “C1.Win.Calendar.C1DateEdit” controls, creation of the form takes significantly longer in version .382.

    See samples in attached zip file (click the first button in the form, the second button shows the workaround described below): with version .296. it takes 0,5 seconds to create the form on my machine. With version .382 (.Net 4.5.2), it takes 2 seconds for the same form. Most of the time seems to be lost in “C1DropDownControl.ApplyThemeToDropDownForm”.

    C1DateEditPerformance.zip

    Now for the interesting part (that’s the reason why I post this here instead of the support tracker, as others might find this workaround helpful): I subclassed “C1DateEdit” and override “DropDownFormCreationTime”:

        protected override CreationTime DropDownFormCreationTime
        {
          get
          {
            return CreationTime.OnFirstCall;
          }
        }
    

    This will delay creation of the dropdown.

    Now performance is great: on first creation it takes 200 milliseconds, later calls will be at 10 milliseconds.

    But this introduces another problem - this seems to be a bug in the control: if I set a value to C1DateEdit programatically, this value is not reflected in the dropdown when it is first shown.

    My workaround in the subclass of C1DateEdit:

    
        protected override void OnCreateDropDownFrom(DropDownForm dropDownForm)
        {
          base.OnCreateDropDownFrom(dropDownForm);
    
          C1.Win.Calendar.DropDownCalendar ddc = (C1.Win.Calendar.DropDownCalendar)dropDownForm;
    
          if (!(this.Value is System.DBNull))
          {
            PropertyInfo propInfo = ddc.GetType().GetProperty("SelectedDate", BindingFlags.Instance | BindingFlags.NonPublic);
            propInfo.SetValue(ddc, this.Value);
          }
        }
    
    

    Unfortunately, the property “SelectedDate” of “C1.Win.Calendar.DropDownCalendar” is not public, so I have to use reflection here.

    Do you think more issues might arise because of the delayed creation of the dropdown?

    Best regards

    Wolfgang

  • Posted 18 November 2019, 9:10 pm EST

    Found some more problems: the properties of “CalendarSettings” are not applied to the dropdown (e.g. “ShowClearButton”, “ShowToday”, “TodayText”).

    So I have to copy them in my “OnCreateDropDownFrom” workaround - also using reflection…

  • Posted 19 November 2019, 8:53 pm EST

    Hello Wolfgang,

    Thank you for the sample.

    We have escalated the case to the developers, will let you know once we get any updates from their side.

    [Internal Tracking Id : 407929]

    Regards,

    Prabhat Sharma.

  • Posted 22 November 2019, 3:20 am EST

    …the property “FirstDayOfWeek” is also not applied to the dropdown when shown the first time - it defaults to “Sunday” instead of “Default” in “c1DateEdit.Calendar.FirstDayOfWeek”.

    Probably there are some more which are not copied ;-)…

    Best regards

    Wolfgang

  • Posted 24 November 2019, 8:52 pm EST

    Hello,

    Thank you for the information.

    We will forward this information to the developers.

    Regards,

    Prabhat Sharma.

  • Posted 5 February 2020, 9:45 pm EST

    Version .405 fixes the performance regression. But for the records: it still takes twice the time to show the form in the sample project if “DropDownFormCreationTime” has value “Default”.

    The other issue (properties like “SelectedDate” and CalendarSettings are not applied to the dropdown) is still open.

    Wolfgang

  • Posted 9 February 2020, 9:35 pm EST

    Hi Wolfgang,

    We too can replicate the issue and discussing this with the developers, will let you know once we get any updates on this.

    Regards,

    Prabhat

  • Posted 5 July 2020, 3:56 am EST

    Hello,

    >>But for the records: it still takes twice the time to show the form in the sample project if “DropDownFormCreationTime” has value “Default”.

    As per the devs, this works as expected. DropDownFormCreationTime.Default means that the drop-down calendar will be created when creating the control. This means that much more time will be spent on creating.

    >>The other issue (properties like “SelectedDate” and CalendarSettings are not applied to the dropdown) is still open.

    This issue has been fixed in the latest hotfix builds i.e. 4.5.2.20201.424 and you can use the builds in your application to resolve the problem that you are getting at your end.

    You can upgrade the builds via latest ComponentOneControlPanel utility by following below given steps:

    1: Run the utility.

    2: Go to the UPDATE tab under the PRODUCTS tab.

    3: Check the option: Include prerelease and hotfix versions.

    4: Expand WinForms and click the update button.

    Regards,

    Prabhat Sharma.

  • Posted 8 July 2020, 10:51 pm EST

    I can confirm that all those properties are applied now.

    But I found another issue - also present in the old version, but I did not notice it up to now: the dropdown size changes after first showing.

    To reproduce: Click the “Show dialog (custom)” button. I made one of the C1DateEdit controls larger than the others. When clicking the dropdown button the first time, the dropdown is wider than after the second dropdown.

    In our “real” app we apply system scaling to the control, and here the dropdown is even wider than the sample when it is shown the first time.

    C1DateEditTest_425.zip

    Best regards

    Wolfgang

  • Posted 9 July 2020, 6:03 pm EST

    Hello Wolfgang,

    Thank you for the sample and the detailed explanation.

    We have escalated this to the developers and will let you known once we get any update on this from their end.

    [Internal Tracking ID: 444936]

    Regards,

    Prabhat Sharma.

  • Posted 4 July 2021, 3:37 pm EST

    Hello Wolfgang,

    This issue has been fixed in the previous builds of ComponentOne. Please update to the latest version using ComponentOneControlPanel to get rid of this issue.

    Regards,

    Prabhat Sharma.

Need extra support?

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

Learn More

Forum Channels