Isac Active Member Licensed User Longtime User Feb 5, 2015 #1 tts1.Speak(EditText1.Text,True)I want him to talk when I press the button, I have trouble moving the sub in the button. I would call this sub inside the button. thank you Code: Sub EditText1_TextChanged (Old As String, New As String) If EditText1.Text.Length > 0 AND EditText1.Text <> Old Then tts1.Speak(EditText1.Text,True) End if [CODE]Sub Button1_Click EditText1_TextChanged (Old As String, New As String) End Sub Last edited: Feb 5, 2015
tts1.Speak(EditText1.Text,True)I want him to talk when I press the button, I have trouble moving the sub in the button. I would call this sub inside the button. thank you Code: Sub EditText1_TextChanged (Old As String, New As String) If EditText1.Text.Length > 0 AND EditText1.Text <> Old Then tts1.Speak(EditText1.Text,True) End if [CODE]Sub Button1_Click EditText1_TextChanged (Old As String, New As String) End Sub
Erel B4X founder Staff member Licensed User Longtime User Feb 6, 2015 #2 Try this: Code: EditText1_TextChanged("", EditText1.Text) Upvote 0
eurojam Well-Known Member Licensed User Longtime User Feb 6, 2015 #3 Code it like this - put your speak in a routine and call it: Code: Sub speak (s As String) tts1.speak(s,True) End Sub Sub EditText1_TextChanged (Old As String, New As String) If EditText1.Text.Length > 0 AND EditText1.Text <> Old Then speak(EditText1.Text) End If End Sub Sub Button1_Click speak(EditText1.Text) End Sub Stefan Upvote 0
Code it like this - put your speak in a routine and call it: Code: Sub speak (s As String) tts1.speak(s,True) End Sub Sub EditText1_TextChanged (Old As String, New As String) If EditText1.Text.Length > 0 AND EditText1.Text <> Old Then speak(EditText1.Text) End If End Sub Sub Button1_Click speak(EditText1.Text) End Sub Stefan