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

PopupClosed fired when the Popup is still visible

5 Answers 183 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Sorin Mecu
Top achievements
Rank 1
Sorin Mecu asked on 24 Nov 2011, 08:02 PM
I'm using RadControls for WinForms 2011.3 11.1116
I have a long operation that is fired at SelectedIndexChanged of an RadDropDownList.
The problem is that when the user makes a selection by opening the popup, the SelectedIndexChanged is fired and the popup is still visible while the long operation associated with the event takes place.
In earlier version(of RadControls) i used a RadComboBox and delayed the SelectedIndexChanged to be fired after the PopupClosed event. This fix for my problem it no longer works with the RadDropDownList because the PopupClosed is fired before the SelectedIndexChanged and while the subscriber of the event is running the IsPopupVisible property is false and the popup is actually visible.
Can you help me identify:
    - an method i could override or event running after the SelectedIndexChanged is fired
    - a property that will indicate me if the Popup is visible or not while processing a subscriber of the SelectedIndexChanged.

Thanks

P.S. I know that moving that operation in a background thread is an alternative solution to my problem, but is not working for me (not because of my skill, the scenario is far more complex than you imagine, and serializing operations via ManualResetEvent is throwing too much complexity in an already complex system)

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 28 Nov 2011, 10:34 AM
Hello Sorin,

Thank you for writing.

In RadDropDownList these events fire in different way, because of the selection made before popup closing. You can check whether the popup is opened with this property:

radDropDownList1.DropDownListElement.IsPopupOpen

Also, you can close popup in SelectedIndexChanged event:
void radDropDownList1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{  
    this.radDropDownList1.Popup.ClosePopup(RadPopupCloseReason.CloseCalled);
}

There is no special event that fires after SelectedIndexChanged.

I hope this helps.

Kind regards,
Peter
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

0
Kim
Top achievements
Rank 1
answered on 15 Aug 2013, 09:08 PM
Hi, 

This is not working for me. In the PopUpClosed event I want to show a dialog. However, the popup would still be visible. I tried Popup.ClosePopup(RadPopupCloseReason.CloseCalled) but its not hiding the popup.

See attached screen shot.

When the user drops down the list, and selects an item. I need to show the dialog.

I can not do this in the SelectedIndexChanged because if they select the same item that is already selected, i still need to show the dialog. SelectedIndexChange does not fire. So I am using Popupclosed. This is working except the popup is still visible when the event is called.

Is there a way i can tell that the user selected the same item again? That would solve my problem.






  
0
Peter
Telerik team
answered on 20 Aug 2013, 11:43 AM
Hi Kim,

Thank you for writing.

This is a normal behavior because DropDownList's popup is closing with an animations and these animations are not finished yet when you call the ShowDialog method. ShowDialog (as all modal dialog) stops all messages in the application message loop and the animation stops. You should disable DropDownAnimations in this case:
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        this.radDropDownList1.DropDownAnimationEnabled = false;
    }
Please, refer to the attached sample project that demonstrates this approach.

I hope this helps.

Regards,
Peter
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kim
Top achievements
Rank 1
answered on 20 Aug 2013, 02:18 PM
Thanks, I will try your suggestion.

This is a confusing event because intuitively one would expect that the event is raised *after* the popup is completely closed and no longer visible. Raising a closed event when it not actually closed is like saying the door is shut when in fact it's only on its way to being shut.

btw these are great products but seems like each component I use always has some odd nuance i have to work around! 

In any case keep up the good work!

Kim



0
Peter
Telerik team
answered on 21 Aug 2013, 01:21 PM
Hello Kim,

I agree with you that this is confusing but this happens because the Modal Dialog stops the animation with all messages in the application.

Actually, the window is closed (check the "((Telerik.WinControls.UI.PopupEditorElement)(sender)).IsPopupOpen == false") but it is still visible because the animation continuously change the form's bitmap opacity.

Regards,
Peter
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
DropDownList
Asked by
Sorin Mecu
Top achievements
Rank 1
Answers by
Peter
Telerik team
Kim
Top achievements
Rank 1
Share this question
or