This is a migrated thread and some comments may be shown as answers.

Prevent RadComoboBox from opening

1 Answer 52 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 10 Feb 2021, 08:02 AM

Users reported a problem in a very old application using Telerik RadComboBox v2017.2.711.45 and I'm trying to find a solution for it, without having to upgrade the telerik controls (we don't have any active subscription or support):

 

Problem is, that when the user selects some text on a page, and releases the left mouse button over a RadComboBox control, then the dropdown opens. E.g:

- user presses left mouse button in a textbox for example
- user moves the mouse to select text
- while the left button is still pressed, the mouse is moved out of the textbox and over a RadComboBox
- user releases the left mouse button (while over the RadComboBox)

--> the dropdown list opens/expands, which is not desired (since the mouse-button down was not over that control)

 

Does anyone have an idea how to approach and fix this problem globally?

Is there for example a way to find a RadComboBox at the current mouse position, so that I could do something in the mousedown/up events?

 

Thanks a lot for any help

1 Answer, 1 is accepted

Sort by
0
Doncho
Telerik team
answered on 15 Feb 2021, 08:13 AM

Hi Martin,

Thank you for the provided information!

This issue occurs only in the Classic Render mode of the RadComboBox. The Classic Render Mode is in maintenance mode since Q3 2015 and only critical bug fixes are provided for it. All the new functionality, controls, and features are developed for the modern Lightweight and Mobile Render Modes, see RenderMode Options.

You can try to work around the issue with the help of the Client-side API of the RadComboBox.
For example, use the OnClientFocus and OnClientBlur to keep track of if the RadComboBox has been focused before releasing the mouse button over the control. If not, you can cancel the OnClientDropDownOpening and prevent the unwanted opening.

<telerik:RadComboBox ID="RadComboBox1" runat="server"
    OnClientDropDownOpening="OnClientDropDownOpening" OnClientFocus="OnClientFocus" OnClientBlur="OnClientBlur">

JavaScript

var isComboOnFocus = false;
function OnClientDropDownOpening(sender, args) {
    if (!isComboOnFocus) {
        args.set_cancel(true);
    }
}
function OnClientFocus(sender, args) {
    isComboOnFocus = true;
}
function OnClientBlur(sender, args) {
    isComboOnFocus = false;
}

Alternatively, you can change the render mode of the Combo to Lightweight, which will affect the appearance.

Please give it a try and let me know how it goes.

Kind regards,
Doncho
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ComboBox
Asked by
Martin
Top achievements
Rank 1
Answers by
Doncho
Telerik team
Share this question
or