Hi all,
I need someone could explain to me about initailize(). I saw this at post#9. I can remember that Klaus told me if I built the panel on layout with the designer ,I must not initailize it. I need more knowledge.
Sub Globals
Dim lblMyLabel As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
lblMyLabel.initialize("")
Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y)
End Sub
this os OK only if you don't use a layout file and you don't want to catch any event from lblMyLabel !
If you want to catch an event from lblMyLabel you must use this code:
B4X:
Sub Globals
Dim lblMyLabel As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
lblMyLabel.initialize("lblMyLabel")
Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y)
End Sub
Sub lblMyLabel_Click
' your code for the click event
End Sub
If lblMyLabel is already in a layout file for exapmle main.bal then you should use this code:
B4X:
Sub Globals
Dim lblMyLabel As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
End Sub