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

OnLostFocus virtual method

6 Answers 79 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Patrick asked on 07 May 2015, 12:43 PM

Hello,

1. When the Combobox receives the focus with a table, nothing appears with the OnLostFocus method and the LostFocus event.
Correct.

2. When the ComboBox is clicked with the mouse the OnLostFocus method is called and then the LostFocus event is raised.
Error: these should not be called.

3. When the ComboBox loses the focus, the LostFocus event is raised, but the OnLostFocus method is not called.
Error: the OnLostFocus method should be called.

Normally, this OnLostFocus method should fire the LostFocus event. It seems to be bypassed in position 3.

6 Answers, 1 is accepted

Sort by
0
Geri
Telerik team
answered on 11 May 2015, 01:22 PM
Hi Patrick,

Thank you for bringing this to our attention.

We have reproduced the issue and it is now logged in our system - you can follow its progress here.

We're not sure what is your scenario, but if you're using RadComboBox in non-editable mode, as a workaround we would suggest you to try editing the "NonEditableTemplate" template of RadComboBox - "PART_DropDownButton" should have the Focusable property set to False. 

Please note the feedback item concerns RadComboBox in a non-editable mode only. For the Editable mode, however, we need to investigate further and can't suggest a workaround at this time.

We're sorry for any inconvenience this may be causing. We have added Telerik points to your account for the report.

Regards,
Geri
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 11 May 2015, 01:31 PM

Hi Geri,

this is an editable ComboBox. Currently, I have replaced the use of the virtual method by the event. I will change again when the bug is corrected.

0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 11 May 2015, 01:33 PM

Hi Geri,

I've look at the issue in your system. it talks about entry 2 in my original post.

What about entry 3 (the virtual method not being called)?

0
Geri
Telerik team
answered on 12 May 2015, 01:12 PM
Hello Patrick,

We apologize for missing entry 3 of your questions.

After further investigating the scenario, we're still unsure that we understand you correctly.
From what we understand, the event handler of the LostFocus event is not being called when the event is raised. In all of our test, this event handler is always called. The LostFocus event is inherited from the framework and there is no virtual method in the source code of the RadComboBox related to it that could be overridden. It would be of great help if you could tell more details about your scenario - for example is the RadComboBox control inherited.

Attached we send you a sample project where we demonstrate a workaround for editable RadComboBox - a check whether the focus is in the current UI element. Please take a look and tell us if it works for you. It would be great if you could modify it according to your scenario, and send it back so we can investigate entry 3 from your original post on our side. 

Also, we plan fixing the issue for both editable and non-editable RadComboBox in some of our upcoming internal builds - please refer to the updated feedback item

Looking forward to your reply.

Regards,
Geri
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 12 May 2015, 02:29 PM

Hi Gero,

yes, I'm inheriting the RadComboBox control and have overriden the OnLostFocus protected virtual method to be notified of the control losing focus,

As said previously, I'm currently using the LostFocus event, because the OnLostFocus virtual method is not called in this case.

0
Geri
Telerik team
answered on 14 May 2015, 10:09 AM
Hi Patrick,

We have investigated the issue and it is now logged in our system - please refer to the feedback item for updates.

As a workaround, we would suggest attaching the event handlers in the constructor of your control in a fashion, similar to the one below:

public class MyRadComboBox : RadComboBox
{
    public MyRadComboBox()
    {
        this.GotFocus += MyRadComboBox_GotFocus;
        this.LostFocus += MyRadComboBox_LostFocus;
    }
 
    void MyRadComboBox_LostFocus(object sender, System.Windows.RoutedEventArgs e)
    {
             
    }
 
    void MyRadComboBox_GotFocus(object sender, System.Windows.RoutedEventArgs e)
    {
             
    }
}

Please try this out and tell us whether it works for you.

We're sorry for the caused inconvenience. As a gratitude for your involvement, we have updated your Telerik points. 

Regards,
Geri
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
ComboBox
Asked by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Geri
Telerik team
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or