RadNumericUpDown focus problems with its internal edit control

6 posts, 1 answers
  1. Joe
    Joe avatar
    85 posts
    Member since:
    Nov 2017

    Posted 04 Dec 2018 Link to this post

    I use RadNumericUpDown in many places.  My application runs on a PC and on the Microsoft Surface and uses the Windows8Touch theme.   

    My problem is that whenever the user types the + or - button of a RadNumericUpDown on the MS Surface, the Window Virtual Keyboard appears, immediately obscuring the very control you are using.  The user isn't trying to edit the text box, mind you, just tapping the buttons.

    I can see the cause:  Whenever you tap one of those buttons, the edit control gets keyboard focus.  This triggers Windows (at a very low level) to pop up the virtual keyboard.

    But if the user is only tapping the buttons, it seems that the edit box should not get focus.  That should not happen until you actually try to *type* in it.   And even if you think it *should* get focus, there at least needs to be a way to prevent it from happening.  

    Here is what I tried:

    1. I tried to setting the entire RadNumericControl's IsEditable property to "False" but this has no effect.  Even though the user cannot edit the box, tapping the UP or DOWN button *still* makes the edit control think it is being edited enough to give it focus and force that virtual keyboard to appear

    2. I tried setting the entire control's "Focusable" property to "False" but that didn't work either.  The internal edit control still gets keyboard focus.  This is because the Telerik template for the control fails to pass the "Focusable" to its internal edit through TemplateBinding. 

    I have managed to "fix" this by copying the entire RadNumericUpDown control's template and making it pass "Focusable" to its internal edit via the TemplateBinding.  Then I use this template for my RadNumericUpDown and set them to not Focusable.

    But I don't want to copy the entire template that because a)it's overkill and b) my copied template is not using the Telerik Windows8Touch theme that I applied to everything else.  So it looks out of place and terrible.  Yeah, maybe I can copy stuff from the Telerik XAML files but again, I'd really prefer a simple property on the RadNumericUpDown.

    Am I missing some simpler method here?  Does RadNumericUpDown give me a way to get at the internal edit control and prevent it from getting keyboard focus short of copying its entire template? 

    Also, am I correct that it's internal edit should NOT get keyboard focus if you just tap the buttons (at least if it's not editable)?

    I am hoping you can point me to an easier way.  

     

  2. Joe
    Joe avatar
    85 posts
    Member since:
    Nov 2017

    Posted 05 Dec 2018 in reply to Joe Link to this post

    Minor correction/clarification.  In the 3rd sentence of my post I wrote 

        "whenever the user types the + or - button"

    But I meant to write

       "whenever the user CLICKS the + or - button"

    That is, this happens when the user clicks the control with the mouse. There is no typing involved.
  3. Joe
    Joe avatar
    85 posts
    Member since:
    Nov 2017

    Posted 06 Dec 2018 Link to this post

    It appears I posted this in the wrong forum.  I did not realize that there was a separate forum devoted specifically to the UpDown control.  I will repost this there.  Please ignore this post
  4. Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 07 Dec 2018 Link to this post

    Hello Joe,

    What might be a possible solution apart from editing the template of the control would be to handle its PreviewGotKeyboardFocus event and set the Handled property of the event arguments to true. If this does not suit your needs, you can stick to the approach of altering the default template. You can copy it from the Themes.Implicit folder in your local installation copy. Within it are the default theme files for each theme. You can copy the template from the Windows8Touch folder so that it has the look and feel of the other components in the application. Can you please give one of these approaches a try?

    I hope this helps.

    Regards,
    Stefan
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Joe
    Joe avatar
    85 posts
    Member since:
    Nov 2017

    Posted 08 Dec 2018 in reply to Stefan Link to this post

    Hi Stefan,

    That approach does fix the problem, however at the cost of me losing all of the styles that would normally be applied by Telerik's RadNumericUpDownStyle (which can be found in the Telerik XAML file for the Windows8Touch style.

    So if I truly want my Windows8TouchStyle, I am still forced to copy all of those styles from the Telerik-supplied XAML file regardless of which approach I use.

    In effect, this is no less overkill then just copying the telerik styles and passing on the "Focusable" property in the TemplateBinding myself.

    That's OK.  I can do this. However in the longer term, I hope you will agree with me that this is a bug that needs to be fixed by Telerik.  Admittedly, a minor bug, but a bug nevertheless.

    That is to say, the template of the RadNumericUpDown control *must* pass on the entire control's  "Focusable" property to its internal edit control.   It makes no sense that a user could set Focusable=false on the entire control only to have the internal edit control ignore it and still gain focus.

    Thanks,

    -Joe

  6. Answer
    Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 12 Dec 2018 Link to this post

    Hello Joe,

    Thank you for the update.

    I would like to clarify, that this behavior is due to the by-design implementation of the control in regards to its focus management. Shortly said, the input box receives focus irrelevant to where exactly the click within the control is. Simply respecting the Focusable property value would not be applicable in this case, as the focus is being set internally in the control logic. I am afraid that we cannot commit to modifying this behavior as this would result in a breaking change. I noticed that this topic is already discussed with my colleague Martin in the other forum thread you opened regarding it. In order to be consistent with our communication may I kindly ask you to continue any further discussion regarding it in the other forum?

    Thank you in advance for understanding.

    Regards,
    Stefan
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top