hello, please try this :
start a new b4j ui project. add a TextField to the layout
this is the code in Main :
run and note the logs order - 1,2,3,4
now, one would expect that the Text_Changed event is fired right when it's changing.
as you can see - it's happening only after the changing sub code ends.
more then that - Button1.text changes to the new TextField.text before the Text_Changed fired.
what if there's a code in the Text_Changed event that for some reason will not approve the change ?
the button text already changed.....
now, please do the same with a new b4a default project.
add an EditText view to layout (instead of TextField used in b4j)
add the same code.
run and note the logs - here, the order is 1,4,3,2
my question : will it stay this way ?
start a new b4j ui project. add a TextField to the layout
this is the code in Main :
b4j:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Button1 As B4XView
Private TextField1 As TextField
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
End Sub
Sub Button1_Click
checkIfToChangeText
End Sub
Private Sub checkIfToChangeText
''code with calculations
Log(1)
TextField1.Text="abc"
Log(2)
Button1.Text=TextField1.Text
Log(3)
''more code enabling / disabling view, no loops
End Sub
Private Sub TextField1_TextChanged (Old As String, New As String)
Log(4)
End Sub
run and note the logs order - 1,2,3,4
now, one would expect that the Text_Changed event is fired right when it's changing.
as you can see - it's happening only after the changing sub code ends.
more then that - Button1.text changes to the new TextField.text before the Text_Changed fired.
what if there's a code in the Text_Changed event that for some reason will not approve the change ?
the button text already changed.....
now, please do the same with a new b4a default project.
add an EditText view to layout (instead of TextField used in b4j)
add the same code.
run and note the logs - here, the order is 1,4,3,2
my question : will it stay this way ?