Autocomplete + Focus issue

6 posts, 0 answers
  1. Alexandre
    Alexandre avatar
    26 posts
    Member since:
    Feb 2008

    Posted 11 Sep 2013 Link to this post

    Hi there,
    I am working with some RadDropDownList with Autocompletemode setted at SuggestAndAppend. The issue happen when when I do press enter or selected a value from dropdown I can't set focus on an other value once the value have been picked. Could you please provide me a workarround for this issue? 

    Thanks
    Alex
  2. Alexandre
    Alexandre avatar
    26 posts
    Member since:
    Feb 2008

    Posted 13 Sep 2013 Link to this post

    I do set the focus on the Keypress event and SelectedIndexChanged both of them didn't work.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 16 Sep 2013 Link to this post

    Hello Alexandre,

    Thank you for contacting Telerik Support.

    RadDropDownList supports AutoCompleteMode = SuggestAppend which means that when typing on the textbox, the autocomplete pop-up shows below with the filtered results along with auto appended text to the textbox. Selecting a value by clicking an item or pressing the Enter key, automatically closes the auto complete pop-up. It will be opened automatically again when typing some text. This is the desired behaviour. Could you please provide more details about the exact scenario which you are trying to achieve with the autocomplete pop-up which differs from the supported one? Thank you in advance.

    Regards,
    Desislava
    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 >>
  5. Alexandre
    Alexandre avatar
    26 posts
    Member since:
    Feb 2008

    Posted 16 Sep 2013 Link to this post

    Thanks for the answer.

    I understand what you say and at this point everything is fine but when I write in the DLL Al and that append ex for Alex and I press enter that fire the selectedindexchanged event where I set the focus on the next DDL the issue happen. I see the focus go on the second DDL but come back to the first one. I also tried on the keypress event and the issue come again but never happen when autocompletemode setted to none...
  6. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 19 Sep 2013 Link to this post

    Hello Alexandre,

    Thank you for writing back.

    In order to change the focus to the second RadDropDownList after selection from the AutoComplete of the first RadDropDownList (pressing Enter key), you may use the following code snippet:
    private void Form1_Load(object sender, EventArgs e)
    {
        // TODO: This line of code loads data into the 'nwindDataSet1.Employees' table. You can move, or remove it, as needed.
        this.employeesTableAdapter.Fill(this.nwindDataSet1.Employees);
        // TODO: This line of code loads data into the 'nwindDataSet.Customers' table. You can move, or remove it, as needed.
        this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
     
        this.radDropDownList1.DisplayMember = "ContactName";
        this.radDropDownList2.DisplayMember = "LastName";
        this.radDropDownList1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
        this.radDropDownList2.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
     
        this.radDropDownList1.GotFocus += radDropDownList1_GotFocus;
        this.radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.PopupClosed += radDropDownList1_PopupClosed;
    }
     
    bool flag = false;
     
    private void radDropDownList1_PopupClosed(object sender, RadPopupClosedEventArgs args)
    {
        if (args.CloseReason == Telerik.WinControls.UI.RadPopupCloseReason.Keyboard)
        {
            flag = true;
            this.radDropDownList2.DropDownListElement.TextBox.TextBoxItem.HostedControl.Select();
        }
    }
     
    private void radDropDownList1_GotFocus(object sender, EventArgs e)
    {
        if (flag)
        {
            this.radDropDownList2.DropDownListElement.TextBox.TextBoxItem.HostedControl.Select();
        }
     
        flag = false;
    }      

    Please, find the attached video (drag and drop over the browser to play), demonstrating the implemented behaviour.

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    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 >>
  7. Alexandre
    Alexandre avatar
    26 posts
    Member since:
    Feb 2008

    Posted 24 Sep 2013 Link to this post

    I did something like this to do what I had to do.

    Thanks for the solution :)
Back to Top
UI for WinForms is Visual Studio 2017 Ready