My first Android app. I have an EditText that is causing problems. If the
user enters a special character (anything other than a letter) The
backspace/delete key does not work, it freezes. I have tried to get around
this by writing a piece of code to trap the delete key down event and delete
the last character entered. This works, but the cursor goes to the first
character in the box instead of next to the last character like I want. 

I need to set the cursor to be at the last (rightmost) character in the
control.

I have found a Java example using getSelectionEnd, but need a c# example
since I can't figure out the C# equivalent.

Here is the code snippet. The EditText control is called
_enterAuthorizedAdult

 if (e.E.Action == KeyEventActions.Down && e.KeyCode == Keycode.Del)
                                                    {
                                                        if
(_enterAuthorizedAdult.Text.Length > 0)
                                                        {
                                                           
_enterAuthorizedAdult.Text =
                                                               
_enterAuthorizedAdult.Text.Substring(0, _enterAuthorizedAdult.Text.Length -
1);
                                                        }
                                                    }

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Need-to-set-cursor-location-in-EditText-control-tp5645003p5645003.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to