Android Question deleting text

tufanv

Expert
Licensed User
Longtime User
Hello,

let say that i have a textbox. In the text box "Welcome" . When the user use backspace to delete a letter i want the textbox to be " " (delete everything). Shortly he wont be able to have welcom or welco or welc .. in the text box he will have welcome or nothing. ( means i want to clear textbox when any of the letters are deleted)

Any way to do it ?

ty
 

stevel05

Expert
Licensed User
Longtime User
I think you may want to set "Welcome" as a hint for the EditText. Then when they start typing the Welcome will disappear.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Try so (I have not tried it)

B4X:
Sub EditText1_TextChanged (Old As String, New As String)
    If Old.IndexOf(New) = 0 AND Old.Length = New.Length + 1 Then
        EditText1.Text = ""
    End If
End Sub

(intercept the Backspace key on EditText (probably this can be achieved using Reflection) would be better)
 
Upvote 0
Top