Hi all,
I have been creating a few of my own customview and find it a little weird as such :
This is the 'header' of my custom view
In my application starts up :
Note that when i call my customview, I HAVE to put a delay Sleep(500) before i can access to any exposed objects in my custom views. Else it will have error have error :
Object was not initialized (B4IPanelView)
The Sleep basically enables the 'mBase.LoadLayout("Bar")' to finish loaded before i can call any object INSIDE the customview
My question is :
1) Is this even the right way to of doing it?
2) How can i make do WITHOUT Sleep(500)
I have been creating a few of my own customview and find it a little weird as such :
This is the 'header' of my custom view
B4X:
Public Sub Initialize (Callback As Object, EventName As String)
mEventName = EventName
mCallBack = Callback
End Sub
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
mBase = Base
CallSubDelayed2(Me, "AfterLoadLayout", Props)
End Sub
Private Sub AfterLoadLayout(Props As Map)
mBase.LoadLayout("Bar") '<<<---------------------LOADING FROM EXTERNAL .bal FORM
mBase.Color=xui.Color_Transparent
End Sub
In my application starts up :
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Sleep(500)'<<---- DELAY DUE TO LOAD FORM FROM CUSTOM VIEW ???????
'-----------------------------------------------------------------------------------------------------------
TW_Bar1.TW_Init_View(2%x,4%x,20dip,5dip,1000)
TW_Bar1.TW_CenterLabel1.Visible=True <<------ EXPOSED LABEL (Set as Public) IN CUSTOMVIEW
Note that when i call my customview, I HAVE to put a delay Sleep(500) before i can access to any exposed objects in my custom views. Else it will have error have error :
Object was not initialized (B4IPanelView)
The Sleep basically enables the 'mBase.LoadLayout("Bar")' to finish loaded before i can call any object INSIDE the customview
My question is :
1) Is this even the right way to of doing it?
2) How can i make do WITHOUT Sleep(500)