First selection attempt for RadDropDownList fails, afterwards is works fine

22 posts, 0 answers
  1. Claude
    Claude avatar
    63 posts
    Member since:
    Apr 2009

    Posted 28 Jul 2011 Link to this post

    I have  a series of RadDropDownList controls whose contents are dynamically assigned at form load time.  Right after the form loads, and one attempts to select an item in any of the RadDropDownList controls, the control does not respond.  It will display the list of items, but it is impossible to select any of them.  The moving highlight bar does not appear, and the first item in the list remains selected.  However, on the second attempt, and all those afterward, it works correctly.  This is true and consistent for every control of this type.

    I have tried various hacks to set the selected index to a different value, and then set it back, but that changed nothing.

    I'm using 2010 Q3 (when I upgraded to the 2011 Q1 version the RadTreeView no longer functioned properly and I didn't have the time to figure out why.  All I know is that a call to the RadTreeView.Clear() method caused a null object exception that did not happen with 2010 Q3).

    The only event I monitor is the selected index changed event.  I don't need it to fire if the index doesn't change, so there was no need to monitor another event.

    All I'm doing on a load is to say something like:

    radDropDownList.Items.Clear();

     

     

    for (int i = 0; i < matrixDateCount; i++)

     

    {

    entry =

     

    new RadListDataItem();

     

    entry.Text =

     

    ConversionMethods.GetDropDownListFormatDateTime(this.allMatrixDateTimes[i]);

     

    radDropDownList.Items.Add(entry);

    }


    Any suggestions would be welcome.

  2. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 29 Jul 2011 Link to this post

    I've run into this behavior as well in Q1 2011 SP1. It is almost as if the dropdownlist opening the first time does not give it focus, but closing it and opening it again does.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Claude
    Claude avatar
    63 posts
    Member since:
    Apr 2009

    Posted 29 Jul 2011 Link to this post

    At least I'm not alone in this.  Did you attempt any fixes or just live with it?
  5. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 29 Jul 2011 Link to this post

    Haven't started to look into a workaround as I have too much work to do. I do not know if this is fixed in Q2 2011, but we are going to wait for the SP release at the end of August because of the Project Updater issue.
  6. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 02 Aug 2011 Link to this post

    Hi Claude,

    Thank you for writing and for the provided code snippet.

    However, I was not able to reproduce the described behavior with my test project using versions Q2 2011 and Q3 2010. Could you modify my sample project in order to reproduce the issue? Please note that you should open a new support ticket in order to be able to attach the modified version of my project.

    I am looking forward for your response.

    All the best,
    Peter
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  7. Claude
    Claude avatar
    63 posts
    Member since:
    Apr 2009

    Posted 02 Aug 2011 Link to this post

    I cannot duplicate the issue in a simple example.  I tried adding a page view and multiple tabs and launching the new form using an event like my project includes.  It may be the issue only comes up when there are a lot of objects in the form, I don't know.  I don't want to pile a bunch of stuff in there and hook it all up to see.  I do know that it's a problem with every RadDropDownList I'm using.

    I just discovered something else, though.  I almost always running in debug mode, so issues like this stand out.  When I install the project, and run it that way, I don't have the problem.  That means it's a minor annoyance to me when I'm developing, but not to anyone else who will be using the product in the field.

    So, I consider the issue closed.
  8. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 05 Aug 2011 Link to this post

    Hi Claude,

    Thank you for writing back.

    If you find what is causing the described behavior, please share this information with us. This will allow us to address any potential issue. If you are not able to find the reason for the wrong behavior, but you can reproduce it in a project of yours, please send us this project so that we can investigate it. Please note that you have to open a new support ticket in order to be able to attach your files.

    Thank you for the cooperation.

    Regards,
    Peter
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  9. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 09 Aug 2011 Link to this post

    I did come up with a workaround. Although it was for sizing the dropdownlist, which wasn't sizing properly, it also worked to set the focus on the dropdownlist after it was opened. I ended up having to call the PopupOpening Event followed by the PopupOpened Event:

    Private Sub cboSalutationID_PopupOpening(sender As Object, e As System.EventArgs) Handles cboSalutationID.PopupOpening
        Dim pWidest As Int32 = 0
        Dim container As DefaultListControlStackContainer = DirectCast(Me.cboSalutationID.DropDownListElement.ListElement.Children(0), DefaultListControlStackContainer)
     
        Try
            For Each item As RadListVisualItem In container.Children
                Dim tParams As New Telerik.WinControls.Primitives.TextParams()
                tParams.text = item.Text
     
                If item.GetTextSize(tParams).Width > pWidest Then
                    pWidest = item.GetTextSize(tParams).ToSize().Width
                End If
            Next
     
            Me.cboSalutationID.Popup.MinimumSize = New Size(pWidest, (Me.cboSalutationID.Items.Count * 16) + 2)
     
        Catch ex As Exception
     
            Throw
     
        Finally
     
        End Try
     
    End Sub
     
    Private Sub cboSalutationID_PopupOpened(sender As Object, e As System.EventArgs) Handles cboSalutationID.PopupOpened
        Dim pWidest As Int32 = 0
        Dim container As DefaultListControlStackContainer = DirectCast(Me.cboSalutationID.DropDownListElement.ListElement.Children(0), DefaultListControlStackContainer)
     
        Try
            For Each item As RadListVisualItem In container.Children
                Dim tParams As New Telerik.WinControls.Primitives.TextParams()
                tParams.text = item.Text
     
                If item.GetTextSize(tParams).Width > pWidest Then
                    pWidest = item.GetTextSize(tParams).ToSize().Width
                End If
            Next
     
            Me.cboSalutationID.Popup.MinimumSize = New Size(pWidest, (Me.cboSalutationID.Items.Count * 16) + 2)
     
        Catch ex As Exception
     
            Throw
     
        Finally
     
        End Try
     
    End Sub

    I imagine something similar would work to ensure focus was properly set on a dropdownlist every time it was opened.
  10. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 11 Aug 2011 Link to this post

    Hello Don,

    Thank you for sharing your solution with the community. I am sure that the others will benefit from it.
    If you have feedback to share or if you have questions, feel free to write back.

    Best wishes,
    Peter
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  11. Mike
    Mike avatar
    22 posts
    Member since:
    Jul 2008

    Posted 23 Aug 2011 Link to this post

    Claude,

    I am experiencing this same problem.  I too noticed that when I ran the application from the compiled .exe file the problem did not occur.  It only occurred when running in Visual Studio.  Also, removing the theme on the control caused the problem to temporarily go away but then it came back after I ran the application a couple times.  I was using the Office2007Black theme.  I have also not been able to build a stand alone project to re-create the issue.  Something seems to have happened during the upgrade to 2011 Q2.

    Mike
  12. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 26 Aug 2011 Link to this post

    Hello Mike,

    Thank you for writing.

    As Peter mentioned in one of the previous posts, we are unable to reproduce the issue. I would suggest trying Don's solution. If it does not work, I would ask you to send us your project through a support ticket. Once we are able to reproduce the issue on our side, we will do our best to find a solution.

    Should you have further questions I would be happy to help.

    Best wishes,
    Ivan Petrov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  13. Nancy
    Nancy avatar
    22 posts
    Member since:
    Jun 2005

    Posted 13 Oct 2011 Link to this post

    This is very interesting!  I have been having this exact same problem with all of my dropdown lists AND my dropdown buttons!  The problem did not occur at all until a certain point where my Winform became more complex with multiple tabs and grids.  Now, as mentioned above, when running in the Visual Studio 2010 IDE, I have to click any dropdown button or any dropdownlist twice to get a selection to take.  I am encouraged that when I create an actual .exe that this problem willl go away (that it is related somehow to running through the IDE only).  Hopefully this will get corrected at some point!
  14. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 18 Oct 2011 Link to this post

    Hi Nancy,

    Thank you for sharing this with us.

    As my colleague Ivan mentioned in his response we are still unable to reproduce the issue, hence investigate it. We will greatly appreciate it if you can open a new support ticket and send us a sample project (or your real project) where the issue occurs. Without this information, it seems that we will not be able to reproduce the described behavior and address it in our future releases.

    Thank you for the cooperation.

    Greetings,
    Peter
    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.

  15. Simon Ampleman
    Simon Ampleman avatar
    4 posts
    Member since:
    Apr 2010

    Posted 04 Jan 2012 Link to this post

    It happens only in debug mode when "Enable unmanaged code debugging" is checked.

    Project -> Properties -> Debug -> Enable Debuggers -> Uncheck "Enable unmanaged code debugging".



  16. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 06 Jan 2012 Link to this post

    Hi Nicolas,

    Thank you for writing and for the provided information.

    These are handled exceptions and probably this exception does not mean an error, because the unmanaged code should throw this exception.

    Thank you for your cooperation.

    All the best,
    Peter
    the Telerik team

    SP1
    of Q3’11 of RadControls for WinForms is available for download (see what's new).
  17. Simon Ampleman
    Simon Ampleman avatar
    4 posts
    Member since:
    Apr 2010

    Posted 06 Jan 2012 Link to this post

    This thread subject is : First selection attempt for RadDropDownList fails, afterwards is works fine.

    Thus... I don't understand your answer.

    So let me explain it again:

    If we check "Enable unmanaged code debugging" in our project. Your combobox doesn't work anymore on the first click. We need to get our cursor out of the combobox area and come back to select the item. (Same thing for ContextMenu).

    If we uncheck "Enable unmanaged code debugging" in our project, your combobox works.

    I haven't say that there is an exception of any sort. It just reacts that way.

    It is also why, it doesn't act this way in "Release" mode.


  18. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 11 Jan 2012 Link to this post

    Hi Nicolas, 

    Despite my efforts I am still unable to reproduce the issue even when I turned on the Unmanaged Exceptions. Could you please refer to the attached video?

    Could you share the problematic project with us? This will greatly help to reproduce the issue and assist you further. Please note that you have to open a new support ticket in order to be able to attach your project.

    Greetings,
    Peter
    the Telerik team

    SP1
    of Q3’11 of RadControls for WinForms is available for download (see what's new).
  19. Simon Ampleman
    Simon Ampleman avatar
    4 posts
    Member since:
    Apr 2010

    Posted 11 Jan 2012 Link to this post

    I just purchased 2011.3 where this problem is gone.

    This bug happened in 2011.1 and maybe previous releases.

    Thank you.
  20. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 13 Jan 2012 Link to this post

    Hi Claude,

    We released many fixes, enhancements and new features in the latest version, but we did nothing deliberate towards this issue, so probably this is a consequence of another optimization. Still, I am glad that you do not experience it anymore.

    Do not hesitate to contact us if you have other questions.

    Kind regards,
    Peter
    the Telerik team

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

  21. Raitis
    Raitis avatar
    2 posts
    Member since:
    Nov 2011

    Posted 19 Mar 2012 Link to this post

    Hi everybody,
    I used 2011 Q3 and 2012 Q1 and that problem still appears.
    This is only available, as Simon noted, when "Enable unmanaged code" is checked.

    I also attached working sample, where you can start project and then expand list and try to click, for example, on second item. And then try to open it again, and then you could click on it.

    Raitis
  22. Raitis
    Raitis avatar
    2 posts
    Member since:
    Nov 2011

    Posted 19 Mar 2012 Link to this post

    Ou... missing attachment.
    I uploaded it here - http://failiem.lv/u/crikjtz
  23. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 22 Mar 2012 Link to this post

    Hello Raitis,

    Thank you for contacting Telerik support and for the provided sample project.

    We cannot reproduce the case (refer to the attached movie) and determine what the reason for the error is, but the nature of the error (when "Enable unmanaged code" is turned on) leads us to the conclusion that this is a handled exception and this exception does not mean an error.

    Do not hesitate to contact us if you have other questions.

    Greetings,
    Peter
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready