RadTextBoxElement and the MouseLeave / Mouse Capture events

3 posts, 0 answers
  1. IT
    IT avatar
    3 posts
    Member since:
    Dec 2017

    Posted 19 Dec 2017 Link to this post

    Hello team,

     

    i got a RadRibbonBar, with RibbonBarGroups in it and one of the RadRibbonBarGroups contains a RadTextBoxElement. Im currently failing at the following goal:

    - i want to catch the moment when the textbox looses the mouse focus.

    Im using the MouseDown event to initiate the user interaction with the textbox and now i want an oposite to that, so that i can recognize if the user has "mousedowned" any other control on the screen.

    I tried the MouseLeave event which seems not to be the totaly right thing, but still better than nothing - this even fires from time to time but i cant tell on which exact condition. Moving the mouse away from the textbox does not always trigger it.

    The MouseLostCapture event - not sure if its right at all - didnt trigger even once.

    Please tell what event should i use for my need?

     

    Thank you!

     

     

     

     

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3465 posts

    Posted 19 Dec 2017 Link to this post

    Hello,  

    Thank you for writing.  

    The appropriate events to handle in this case are the GotFocus and LostFocus event of the RadTextBoxElement.TextBoxItem:
    public RadForm1()
    {
        InitializeComponent();
     
        this.radTextBoxElement1.TextBoxItem.GotFocus+=TextBoxItem_GotFocus;
        this.radTextBoxElement1.TextBoxItem.LostFocus+=TextBoxItem_LostFocus;
    }
     
    private void TextBoxItem_LostFocus(object sender, EventArgs e)
    {
        Console.WriteLine("LostFocus");
    }
     
    private void TextBoxItem_GotFocus(object sender, EventArgs e)
    {
        Console.WriteLine("GotFocus");
    }

    There are fired when the RadTextBoxElement gets/loses the focus.

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. IT
    IT avatar
    3 posts
    Member since:
    Dec 2017

    Posted 19 Dec 2017 Link to this post

    Thank you, that helped me a lot!
Back to Top