Hello,
I was about to implement the colorslist example in my application.
ColorsList class:
So even the layout "main" contains ColorsList1 as customview, the class doesn't recognize colorslv as already initialized ...
If anybody has an idea, i really appreciated - after days of experimentation I cannot explain the behaviour,
Thanks, Chris
I was about to implement the colorslist example in my application.
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim xui As XUI
Private pnlCols As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main") <==== includes ColorsList1 customview inside panel pnlCols
pnlCols.Visible = False
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub lblCol_click ' show colorpanel as panel
Dim lbl As Label = Sender
pnlCols.Visible = True
End Sub
Sub ColorsList1_ItemClick (cname As String, Clr As Int)
Log("received name = "& cname)
Activity.Color = Clr
pnlCols.Visible = False
End Sub
ColorsList class:
B4X:
#Event: ItemClick (Clr As Int)
Sub Class_Globals
Private mEventName As String 'ignore
Private mCallBack As Object 'ignore
Private mBase As B4XView 'ignore
Private xui As XUI 'ignore
Private colorslv As CustomListView <==== error: is not initialized !!
Private ColorLabel As B4XView
Private ColorPanel As B4XView
Private editsearchCol As EditText
End Sub
Public Sub Initialize (Callback As Object, EventName As String)
mEventName = EventName
mCallBack = Callback
Log(EventName)
End Sub
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
mBase = Base
Sleep(0) 'cannot load layouts in DesignerCreateView without calling Sleep before
mBase.LoadLayout("listtemplate")
colorslv.sv.SetColorAndBorder(xui.Color_Transparent, 0, 0, 0) <==== error in runtime: null object reference !!
So even the layout "main" contains ColorsList1 as customview, the class doesn't recognize colorslv as already initialized ...
If anybody has an idea, i really appreciated - after days of experimentation I cannot explain the behaviour,
Thanks, Chris