AutoCompleteBox and spaces

6 posts, 0 answers
  1. Doug Cowperthwaite
    Doug Cowperthwaite avatar
    3 posts
    Member since:
    Jun 2009

    Posted 15 Apr 2013 Link to this post

    Using 2013 Q1 controls.  I have items in the suggestion list for an AutoCompleteBox that have spaces (similar to the example in your documentation that uses first and last names).  The AutoCompleteBox ignores spaces typed in the textbox.  I can paste a partial value with spaces into the text box and the suggestion list displays the correct matching entries.  The suggestion list contains thousands of items, so first word often does not provide a close enough match.

    I saw that there is another question regarding the same issue.  In that thread, it is implied that the question was answered in another thread, but the hyperlink goes to an unrelated topic. I cannot find an answer to this question by browsing or searching the forum.
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 18 Apr 2013 Link to this post

    Hi Doug,

    Thank you for writing.

    We are aware of this issue and have it logged in our Public Issue Tracking System - PITS. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - PITS Issue. I have attached an example project where I have created a custom AutoCompleteBox that has this issue addressed. You can use it until the issue is resolved.

    I hope this will be useful. Should you have further questions, I would be glad to help.

    Regards,
    Ivan Petrov
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Doug Cowperthwaite
    Doug Cowperthwaite avatar
    3 posts
    Member since:
    Jun 2009

    Posted 22 Apr 2013 Link to this post

    The example works in Suggest mode, but does not help when using SuggestAppend.   The only downside to using Suggest mode is that it can leave untokenized, undelimited text in the control when the user tabs or clicks out of the control.  The successfully tokenized items are intact, but it is not a great visual.   Since the functionality is more important, I'll live with Suggest mode unless there is a workaround for SuggestAppend mode.
  5. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 25 Apr 2013 Link to this post

    Hello Doug,

    Thank you for writing back.

    I have attached a modified version of the previous project where I have implemented a workaround that will work in both AutoCompleteModes. Although, this works in SuggestAppend the mode itself cannot guarantee you that users are not allowed to enter random text and to tab out.

    I hope this will help. Do not hesitate to write back with further questions.

    All the best,
    Ivan Petrov
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  6. Doug Cowperthwaite
    Doug Cowperthwaite avatar
    3 posts
    Member since:
    Jun 2009

    Posted 25 Apr 2013 Link to this post

    Thanks. That works great.

    I've gotten around the problem with random text being entered by calling this from the Validated event on the control.  It removes the untokenized text by rebuilding the text from the tokenized elements.  The only interesting behavior is that the tokenized elements are alphabetized, so the order of the items may change when the user tabs out of the control.  That is not totally undesired in this case.

    public void RemoveUntokenizedText(object sender, EventArgs e)
    {
        ucRadAutoCompleteBox ctl = (ucRadAutoCompleteBox) sender;
     
        if (!String.IsNullOrEmpty(ctl.Text))
        {
            string newText = "";
            //RadTokenizedTextItemCollection oldItems = ctl.Items;
            //ctl.Clear();
     
            foreach (RadTokenizedTextItem i in ctl.Items)
            {
                newText += i.Text + ";";
            }
            ctl.Text = newText;
        }
    }
  7. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 29 Apr 2013 Link to this post

    Hi Doug,

    Thank you for your reply.

    I am glad we have been able to find a solution to your problem.

    Feel free to write back with further questions.

    Regards,
    Ivan Petrov
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top
UI for WinForms is Visual Studio 2017 Ready