How to use shortcut to copy selected text in message?

1 Answer 27 Views
Conversational UI, Chat
Vitaly
Top achievements
Rank 1
Vitaly asked on 31 Jul 2024, 12:42 PM
I know how to copy text using context menu, but I also need copy text using shortcut.

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 05 Aug 2024, 09:57 AM

Hello, Vitaly,

Following the provided information, I suppose that you already get know the following KB article: How to Select and Copy Text in Chat Messages - Telerik UI for WinForms. Should you have missed it, I would highly recommend referring to it as the solution I propose here jyst extend the one in the above-mentioned KB article.

In order to copy text using shortcut (Ctrl+C) you should use the same approach for displaying RadTextBoxControlElement in the ChatMessageBubbleElement. However, the input text box in RadChat control steals the focus every time when RadChat control is focused. To prevent this, you should create a custom chat control which inherits from RadChat and override the OnGotFocus method in the following way:

public class MyChat : RadChat
{

    protected override void OnGotFocus(EventArgs e)
    {

        if (this.Behavior.OnGotFocus(e))
        {
            return;
        }

    }
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadChat).FullName;
        }
    }
}

Thus, you should be able to copy text from the RadTextBoxControlElement using shortcut and paste it whenever you like. Take a look at the attached gif file. 

I hope this information helps. If you have any other questions, please let me know.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Conversational UI, Chat
Asked by
Vitaly
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or