Chianca Member Licensed User Longtime User Dec 16, 2013 #1 Hello, i'm having some problems to fire the TextChanged event of an EditText, cause i'm creating it by code, like this example above: ScrollView_Customer.Panel.AddView(CreateTextBox("0","EdtName","Name"),0,TopDistance,EditTextWidth,EditTextHeight) The CreateTextBox return an EditText element and before i create it, i cant use TextChanged event of this EditText. How can i solve this problem? Thanks to all!
Hello, i'm having some problems to fire the TextChanged event of an EditText, cause i'm creating it by code, like this example above: ScrollView_Customer.Panel.AddView(CreateTextBox("0","EdtName","Name"),0,TopDistance,EditTextWidth,EditTextHeight) The CreateTextBox return an EditText element and before i create it, i cant use TextChanged event of this EditText. How can i solve this problem? Thanks to all!
stevel05 Expert Licensed User Longtime User Dec 16, 2013 #2 Can you show us the code of the CreateTextBox and the signature for the CallBack sub "_TextChanged(Old As String, New As String)" Upvote 0
Can you show us the code of the CreateTextBox and the signature for the CallBack sub "_TextChanged(Old As String, New As String)"
Chianca Member Licensed User Longtime User Dec 17, 2013 #3 stevel05 said: Can you show us the code of the CreateTextBox and the signature for the CallBack sub "_TextChanged(Old As String, New As String)" Click to expand... Sure, here is the code: 1st: Add the EditText: Code: Copy ScrollView_Customer.Panel.AddView(CreateTextBox("0","EdtName","Name"),0,TopDistance,EditTextWidth,EditTextHeight) 2nd: CreateTextBox SUB: Code: Copy 'Sub CreateTextBox Sub CreateTextBox(DataType As String,TagId As String, TxtHint As String) As EditText Dim edt As EditText edt.Initialize("EditText") edt.SingleLine = True edt.Tag = TagId edt.Hint = TxtHint edt.Color = Colors.RGB(240,240,240) edt.TextColor = Colors.Black If DataType = "0" Then edt.InputType = edt.INPUT_TYPE_TEXT Else If DataType = "1" Then edt.InputType = edt.INPUT_TYPE_NUMBERS Else If DataType = "2" Then edt.InputType = edt.INPUT_TYPE_DECIMAL_NUMBERS Else If DataType = "3" Then edt.InputType = edt.INPUT_TYPE_PHONE End If Return edt End Sub 3rd: TextChanged Code: Copy 'TextChanged Event Sub EdtName_TextChanged(Old As String,New As String) EdtName.color = Colors.White End Sub Last edited: Dec 17, 2013 Upvote 0
stevel05 said: Can you show us the code of the CreateTextBox and the signature for the CallBack sub "_TextChanged(Old As String, New As String)" Click to expand... Sure, here is the code: 1st: Add the EditText: Code: Copy ScrollView_Customer.Panel.AddView(CreateTextBox("0","EdtName","Name"),0,TopDistance,EditTextWidth,EditTextHeight) 2nd: CreateTextBox SUB: Code: Copy 'Sub CreateTextBox Sub CreateTextBox(DataType As String,TagId As String, TxtHint As String) As EditText Dim edt As EditText edt.Initialize("EditText") edt.SingleLine = True edt.Tag = TagId edt.Hint = TxtHint edt.Color = Colors.RGB(240,240,240) edt.TextColor = Colors.Black If DataType = "0" Then edt.InputType = edt.INPUT_TYPE_TEXT Else If DataType = "1" Then edt.InputType = edt.INPUT_TYPE_NUMBERS Else If DataType = "2" Then edt.InputType = edt.INPUT_TYPE_DECIMAL_NUMBERS Else If DataType = "3" Then edt.InputType = edt.INPUT_TYPE_PHONE End If Return edt End Sub 3rd: TextChanged Code: Copy 'TextChanged Event Sub EdtName_TextChanged(Old As String,New As String) EdtName.color = Colors.White End Sub
stevel05 Expert Licensed User Longtime User Dec 17, 2013 #4 You are initializing the EditText EventName as "EditText". The TextChanged event sub signature should be: Code: Copy Sub EditText_TextChanged(Old As String,New As String) Dim ET AS EditText = sender ET.Color = Colors.White End Sub to get the EditText that was changed you need to use the Sender keyword as in my example. Upvote 0
You are initializing the EditText EventName as "EditText". The TextChanged event sub signature should be: Code: Copy Sub EditText_TextChanged(Old As String,New As String) Dim ET AS EditText = sender ET.Color = Colors.White End Sub to get the EditText that was changed you need to use the Sender keyword as in my example.
Chianca Member Licensed User Longtime User Dec 17, 2013 #5 stevel05 said: You are initializing the EditText EventName as "EditText". The TextChanged event sub signature should be: Code: Copy Sub EditText_TextChanged(Old As String,New As String) Dim ET AS EditText = sender ET.Color = Colors.White End Sub to get the EditText that was changed you need to use the Sender keyword as in my example. Click to expand... Hey Man, thank you! Your tip has solved my problem, it works perfectly! Upvote 0
stevel05 said: You are initializing the EditText EventName as "EditText". The TextChanged event sub signature should be: Code: Copy Sub EditText_TextChanged(Old As String,New As String) Dim ET AS EditText = sender ET.Color = Colors.White End Sub to get the EditText that was changed you need to use the Sender keyword as in my example. Click to expand... Hey Man, thank you! Your tip has solved my problem, it works perfectly!