This is a migrated thread and some comments may be shown as answers.

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

6 Answers 45 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 24 Nov 2012, 04:19 AM
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.

6 Answers, 1 is accepted

Sort by
0
Accepted
Giovanni
Top achievements
Rank 1
Iron
answered on 26 Nov 2012, 04:23 PM
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,

0
Svett
Telerik team
answered on 28 Nov 2012, 02:47 PM
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.
0
Dan
Top achievements
Rank 1
answered on 29 Nov 2012, 02:48 AM
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!
0
Svett
Telerik team
answered on 30 Nov 2012, 03:08 PM
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.
0
Fraser Tustian
Top achievements
Rank 1
answered on 28 May 2014, 05:22 AM
+1 request from me

This functionality is pretty critical
0
Dimitar
Telerik team
answered on 30 May 2014, 12:58 PM
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.
 
Tags
AutoCompleteBox
Asked by
Dan
Top achievements
Rank 1
Answers by
Giovanni
Top achievements
Rank 1
Iron
Svett
Telerik team
Dan
Top achievements
Rank 1
Fraser Tustian
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or