C1.Win.C1Calendar.C1DateEdit.InitialSelection

Posted by: SHanau on 8 February 2022, 9:03 pm EST

  • Posted 8 February 2022, 9:03 pm EST

    Hi,

    I'm facing a problem with C1.Win.C1Calendar.C1DateEdit's InitialSelection. I've set it to InitialSelectionEnum.SelectAll. If the control gets the focus by pressing TAB the whole input area is being selected correctly. But when I click into the input section by mouse the input area isn't selected at all.

    Furthermore I've set the InitialField property to DateTimeField.DayOfMonth which isn't also recognized when the control gets the focus by click. Instead the cursor stays at the position of the input area where the user has placed it.

    How can I achieve the requested behaviour ? I'm using C1 WinForms Edition 2021v2 (513).

    Thanks in advance,
    Stephan
  • Replied 9 February 2022, 9:39 pm EST

    Hi,

    You'll have to handle the click event and call SelectAll() method.


    Private Sub C1DateEdit1_Click(sender As Object, e As EventArgs) Handles C1DateEdit1.Click
    C1DateEdit1.SelectAll()
    End Sub
  • Replied 9 February 2022, 11:50 pm EST

    Hi,

    Currently, When the C1DateEdit is focused by a mouse click, it automatically focuses the clicked field. If the C1DateEdit is focused by using the TAB key, then it follows the InitialField property is used.
    We have escalated the case to the development team to get their insights and if there is a workaround they can suggest. We will let you know as soon as we have an update.

    Regards
    Avnish
  • Replied 9 February 2022, 11:54 pm EST

    [Tracking ID : C1WIN-26804]
  • Replied 10 February 2022, 2:05 am EST

    fsegui said:
    Hi,

    You'll have to handle the click event and call SelectAll() method.


    Private Sub C1DateEdit1_Click(sender As Object, e As EventArgs) Handles C1DateEdit1.Click
    C1DateEdit1.SelectAll()
    End Sub


    Right, but I would have to hardcode it on every single occurance. I'd rather have a property which does it automatically. Thanks anyway.
  • Replied 10 February 2022, 10:10 pm EST

    Hi,

    As per the development team, you can use the attached workaround.
    You can inherit from the C1DateEdit control and call the protected method UpdateSelection() after MouseUp to reset the selection to the initial value.
    To avoid update selection on mouse click after focus is received by keyboard, you an add timer with a very small interval.
    Please refer to the sample attached.

    Regards
    Avnish

    Workaround_Test.zip
Need extra support?

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

Learn More

Forum Channels