Keyboard Events not firing.

5 posts, 0 answers
  1. Karl Hunsley
    Karl Hunsley avatar
    1 posts
    Member since:
    Oct 2006

    Posted 26 May 2009 Link to this post

    Hello,

    I am using a masked edit control on my form, and would like to tie in some keyboard handling code to allow my userbase to operate the software without using a mouse.  However if I connect an event handler to the KeyDown/Up events my code is never executed.

    My masked text box has a very simple mask of "######" and is in standard mode.  Just to make sure it was not me missing something, I placed a standard Winforms masked text box onto my form by the side of the Telerik control and this behaved as expected and fired the KeyUp/Down events.

    I am using VS2008 SP1 and my project is set to use .Net V3.5.

    Anyone got any ideas, I can not see any properties that need to be set in order to enable these events.  Its causing me a lot of trouble, as I will need to use quite a few of these controls to get my application  completed.

    Best Regards,

    Karl Hunsley

  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 29 May 2009 Link to this post

    Hello Karl Hunsley,

    I hope that this will help. Here is a way to access the internal textbox used in the maskbox control.

         this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.HostedControl.KeyDown += new KeyEventHandler(HostedControl_KeyDown);
       
    You need to subscribe to KeyDown event. You can use the same logic for the other Key events of the control.

    Please contact me again if you need more information.

    Sincerely yours,
    Boyko Markov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. José Miguel
    José Miguel avatar
    4 posts
    Member since:
    May 2009

    Posted 10 Jun 2009 Link to this post

    I'm still having the same problem even using the event keydown event that is described:

    this.txtContrasenia.MaskedEditBoxElement.TextBoxItem.HostedControl.KeyDown +=new System.Windows.Forms.KeyEventHandler(HostedControl_KeyDown);

    and the function ...

     

    void HostedControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)

     

     

    {

     

     

     

     if (e.KeyCode == Keys.Enter)

     

     

     

         MessageBox.Show("hello");

     

     

     

    }

    Additionally I'm getting this error when I try to view my Form in desgin mode (and I cannot see the Form):
    Warning 1 Events cannot be set on the object passed to the event binding service because a site associated with the object could not be located. C:\nettiers\SRFTBD\SRFTBD.Ventas.Forms\FormAutenticarUsuario.Designer.cs 93 0 

     

  5. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 10 Jun 2009 Link to this post

    Hello Jose Miguel,

    I have attached a very simple sample application demonstrating how to subscribe to KeyDown event. The key thing here is to set the MaskType property to use this behavior because when MaskType is None the control doesn't work as a maskbox, but as a standard textbox. Please write me back if you need more information.

    Greetings,
    Boyko Markov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. José Miguel
    José Miguel avatar
    4 posts
    Member since:
    May 2009

    Posted 10 Jun 2009 Link to this post

    Thanks Boyko Markov, I realized about the problem.

    Greetings,
    José Gutiérrez
Back to Top
UI for WinForms is Visual Studio 2017 Ready