EditText in code versus in Designer

wdegler

Active Member
Licensed User
Longtime User
In the following code, EdtTxt_EnterPressed is never called when Enter is pressed on the EdtTxt view. It works if EdtTxt is defined in Designer instead, however. What is wrong here?

Sub Globals
Dim EdtTxt As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Test")
EdtTxt.Initialize("")
Activity.AddView(EdtTxt,20,20,100,40)
EdtTxt.RequestFocus
End Sub
Sub EdtTxt_EnterPressed
EdtTxt.Text="Good!"
End Sub
Sub Activity_Resume
End Sub
 

klaus

Expert
Licensed User
Longtime User
You should have posted this question in the Basic4Android Furum, this one is for Basic4PPC.

This behaviour is normal, because in the Initilize kayword you have omitted the evant name.
EdtTxt.Initialize("")

must be, in your case:
EdtTxt.Initialize("EdtTxt")

and the event routine.
Sub EdtTxt_EnterPressed

Best regards.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…