RadComboBoxElement & autocomplete

5 posts, 0 answers
  1. Loy Chan
    Loy Chan avatar
    21 posts
    Member since:
    Mar 2008

    Posted 14 Nov 2008 Link to this post

    I use a Radcomboxelement on my toolbar as a staff filter. The combobox contains a large number of staff names and a "All" option. I've set it up to use autocomplete AppendSuggest.

    The problem lies when after the user selects a specific staff and then wants to go back to the "All" option. Rather than scroll back up to the top, they want to the just clear the comboxbox text.

    In the past, when I used the regular windows toolbar combobox, there's a "Leave" event that I can use to check the value of the combobox text and if it's blank, I'll set the selectedindex to the "all" option.

    Unfortunately, the RadComboBoxElement class does not inherit from Control so it doesn't have this event.

    Any suggestions?
  2. Loy Chan
    Loy Chan avatar
    21 posts
    Member since:
    Mar 2008

    Posted 14 Nov 2008 Link to this post

    Another problem arises ...

    If the user starts typing in the combobox element, the auto complete functionality (set to AppendSuggest) will display the matching item text. If the user presses "enter" then the item will be selected.

    But if the user tabs away or clicks away (ie. combobox loses focus), the combobox text will remain but the selectedindex will not correspond to the displayed text.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 18 Nov 2008 Link to this post

    Hello Loy Chan,

    As a workaround for your first problem you can use the TextBoxElement property of the RadComboBoxElement to obtain a real Leave event from the text control used inside the combobox. The code i:
     
    (TextBoxElement.TextBoxItem.HostedControl as TextBox).Leave += .... 
     
    There you can put the code you usually execute on leave.

    Regarding your second problem, could you elaborate a bit more? By design you should explicitly set the index on pressing Enter. How does the behavior of our combobox deffer from the standard one provided with the .NET Framework?
     
     
    Best wishes,
    Dimitar Kapitanov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Loy Chan
    Loy Chan avatar
    21 posts
    Member since:
    Mar 2008

    Posted 18 Nov 2008 Link to this post

    Thanks.

    It worked exactly like i need it to.

    Regarding my 2nd problem, I'm not sure exactly how a normal windows combo box is suppose to handle that situation but to me, it's a consistency issue. If I tab away from the combobox after I've typed in some text, I would look back at that combobox and think that the displayed text is actually the text of the selected item.

    Regardless, I was able to handle the situation with the Leave event.

    Thanks again.
  6. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 21 Nov 2008 Link to this post

    Hello Loy Chan,

    Thank you for getting back to us.

    Actually, RadComboBox behavior is consistent to the one of Microsoft ComboBox. When you type some text in RadComboBox or ComboBox, and if an item with such text exists, it will become the selected item (and the SelectedIndexChanged event will be fired) when you Tab off the control. I am attaching a sample project to demonstrate this.

    If you have additional questions, feel free to contact me.

    Sincerely yours,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for WinForms is Visual Studio 2017 Ready