Is this a question? Yes but mainly it is a... "discovery"/info.
You can not declare a View in Process_Globals (the message you get is:
but... you can declare there a Type containing Views and use an object of that type in your Activity.
Tested so:
This code works without problems.
P.S. It works even with "simple" views (which is my purpose; the first example makes no sense in that way, of course):
You can not declare a View in Process_Globals (the message you get is:
but... you can declare there a Type containing Views and use an object of that type in your Activity.
Tested so:
B4X:
Sub Process_Globals
Type tViews(CV As cvFake) ' cvFake is a Custom View with just the default stuff.
End Sub
Sub Globals
Private cvFake1 As cvFake
Private marr(1) As tViews
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layMain")
marr(0).CV = cvFake1
Sleep(1000)
marr(0).CV.GetBase.Color = Colors.Blue
End Sub
This code works without problems.
P.S. It works even with "simple" views (which is my purpose; the first example makes no sense in that way, of course):
B4X:
Sub Process_Globals
Type tViews(CV As cvFake, lbl As Label)
End Sub
Sub Globals
Private cvFake1 As cvFake
Private marr(1) As tViews
Private Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layMain")
marr(0).CV = cvFake1
marr(0).lbl = Label1
Sleep(1000)
marr(0).CV.GetBase.Color = Colors.Blue
marr(0).lbl.Text = "ciao"
End Sub
Last edited: