Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Editors (TextBox, MaskedEdit, SpinEditor, BrowseEditor, ColorBox) > RadTextBox click and double click events

Not answered RadTextBox click and double click events

Feed from this thread
  • Max avatar

    Posted on May 11, 2008 (permalink)

    Hi!
    In new version these events works only if you click on the border of the textbox, how can I catch event when user click on "work" space of textbox ?

    Reply

  • Martin Vasilev Martin Vasilev admin's avatar

    Posted on May 12, 2008 (permalink)

    Hi Max,

    Thank you for the question.

    You could handle the Click and DoubleClick events in TexBoxItem by using the code provided below:

    private void Form1_Load(object sender, EventArgs e)  
    {  
        this.radTextBox1.TextBoxElement.TextBoxItem.Click += new EventHandler(TextBoxItem_Click);  
        this.radTextBox1.TextBoxElement.TextBoxItem.DoubleClick += new EventHandler(TextBoxItem_DoubleClick);  
    }  
     
    void TextBoxItem_DoubleClick(object sender, EventArgs e)  
    {  
        //do something...  
    }  
     
    void TextBoxItem_Click(object sender, EventArgs e)  
    {  
        //do something...  

    I hope this helps. If you need additional assistance, do not hesitate to contact me again.

    Sincerely yours,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Arve Asheim avatar

    Posted on May 7, 2010 (permalink)

    This workaround makes me go into every load page code and wire the events, this is alot of work when I'm just upgrading a project that already has 1000's of event handlers.

    How can you make the RadTextBox.TextBoxElement.TextBoxItem.Click event call the RadTextBox.Click event?
    I was thinking inheriting the RadTextBox and rethrow the event from the textboxitem...
    Other suggestions / code is appreciated.

    Reply

  • Martin Vasilev Martin Vasilev admin's avatar

    Posted on May 13, 2010 (permalink)

    Hello Arve Asheim,

    Thank you for getting back to me.

    Actually, you can override RadTextBox control and link its Click event to the TextBoxItem's Click event. Please, consider the following code:
    class CustomTextBox : RadTextBox
        {
            public CustomTextBox()
            {
                this.TextBoxElement.TextBoxItem.Click += new EventHandler(TextBoxItem_Click);
                this.TextBoxElement.TextBoxItem.DoubleClick += new EventHandler(TextBoxItem_DoubleClick);
            }
      
            void TextBoxItem_DoubleClick(object sender, EventArgs e)
            {
                base.OnDoubleClick(e);
            }
      
            void TextBoxItem_Click(object sender, EventArgs e)
            {
                base.OnClick(e);
            }
      
            public override string ThemeClassName
            {
                get
                {
                    return typeof(RadTextBox).FullName;
                }
            }   
        }

    Let me know if you have any other questions.

    Greetings,
    Martin Vasilev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

    Reply

  • Posted on Oct 18, 2011 (permalink)

    Hi Martin,

    I don't want to hijack the thread, but can you tell me how then if we are using the EventArgs instead of MouseEventArgs can we tell which button (left button or right button) the user double-clicked with - in my case there needs to be a difference. Also, based on the example given seems like Click is always occurring no matter how fast I double-click.

    Thank you.

    Dave Galligher

    Reply

  • Posted on Oct 18, 2011 (permalink)

    I figured out the issue with the button - right or left, you need to convert the EventArg to a MouseEventArg and then read what button was clicked. Original click issue still stands when both events are defined.

    Reply

  • Martin Vasilev Martin Vasilev admin's avatar

    Posted on Oct 21, 2011 (permalink)

    Hi Dave,

    I am glad you have a found solution for your scenario. Do not hesitate to contact us if you have any other questions.

    All the best,
    Martin Vasilev
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Editors (TextBox, MaskedEdit, SpinEditor, BrowseEditor, ColorBox) > RadTextBox click and double click events
Related resources for "RadTextBox click and double click events"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]