AutoCompleteBox - How to "accept" undelimited text when focus is lost

7 posts, 1 answers
  1. Dan
    Dan avatar
    11 posts
    Member since:
    Feb 2012

    Posted 23 Nov 2012 Link to this post

    I've read all the Methods, Properties, etc. and have now given up.

    How do I "force" the AutoCompleteBox to process the last remaining text in the text box as if the user had actually typed in a ";" at the end.  Specifically, when loosing focus, my users are not always entering in the delimiter ";" that then causes the control to tokenize the last word(s) they entered into the control.  On loss of focus, I would like to see if there is any non-tokenized text in the control and then process/tokenize it.

    I have tried hacking around by sending the control a ";" via SendKeys.Send(";") but that simply did not work (it was a horrible hack anyway).  Any great ideas would be appreciated.

  2. Answer
    Giovanni
    Giovanni avatar
    37 posts
    Member since:
    Feb 2011

    Posted 26 Nov 2012 Link to this post

    I have a similar problem, i.e. how to access to current untokenized string.
    At the moment I used a workaround using this code:


    If Me.TxtValue.CaretIndex > 0 Then
        Try
            Dim searchingText As String = Me.TxtValue.Text.Substring(0, Math.Min(Me.TxtValue.CaretIndex, Me.TxtValue.Text.Length))
            Dim pos As Integer = Math.Max(0, searchingText.LastIndexOf(";"c))
            ' Delete current untokenized text
            Me.TxtValue.Select(pos, Me.TxtValue.CaretIndex - pos)
            Me.TxtValue.Delete()
        Catch
        End Try
    End If
    Me.TxtValue.AppendText(valueToSave & ";"c)

    But like you, I hope to know a better way,

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Svett
    Admin
    Svett avatar
    728 posts

    Posted 28 Nov 2012 Link to this post

    Hello Guys,

    @Dan: You can use the approach suggested by the Giovanni.

    @Gioavanni: Thank you for your community effort. I have updated your Telerik points for your time and efforts.
     
    Kind regards,
    Svett
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  5. Dan
    Dan avatar
    11 posts
    Member since:
    Feb 2012

    Posted 28 Nov 2012 Link to this post

    I've used something very similar to Giovanni's method (thanks!).  In hindsight, my hack was horrible ;)

    Please add a request for the development team to have an "auto submit" feature such that on loss of focus, whatever existing text the user has typed in is processed as if it was delimited.  That would improve the usability of this control ten fold.

    Thanks much!
  6. Svett
    Admin
    Svett avatar
    728 posts

    Posted 30 Nov 2012 Link to this post

    Hello Dan,

    Thank you for your suggestion. We will consider it if we receive more requests about the same functionality. For the time being, feel free to use the approach discussed. 
     
    Greetings,
    Svett
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  7. Fraser Tustian
    Fraser Tustian avatar
    18 posts
    Member since:
    Sep 2012

    Posted 28 May 2014 in reply to Svett Link to this post

    +1 request from me

    This functionality is pretty critical
  8. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 30 May 2014 Link to this post

    Hi Fraser,

    Thank you for your request. We will consider it in future control improvements.

    Regards,
    Dimitar
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready