I am trying to create my first class. I want to dynamically create a layout so that it is not necessary for users of this class to create a layout using the designer.
Problem is that I cannot seem to get the Base_Resize event to fire from within the class. It must be something simple.
Here is the class code:
Problem is that I cannot seem to get the Base_Resize event to fire from within the class. It must be something simple.
Here is the class code:
B4X:
Sub Class_Globals
Private xui As XUI 'ignore
Private fx As JFX
Private mEventName As String 'ignore
Private mCallBack As Object 'ignore
Private mBase As B4XView
Private xPnl As B4XView
End Sub
'You can add more parameters here.
Public Sub Initialize (Callback As Object, EventName As String)
mEventName = EventName
mCallBack = Callback
DesignerCreateView(mCallBack)
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
'load the layout to Root
'Root = Root1
End Sub
Public Sub DesignerCreateView (Base As Object)
Log("DesignerCreateView")
mBase = Base
xPnl = xui.CreatePanel("xPnl")
mBase.AddView(xPnl,0,0,mBase.Width,40dip)
mBase.BringToFront
End Sub
' DOES NOT FIRE
Private Sub Base_Resize (Width As Int, Height As Int)
Log("Base_Resize " & Width & " x " & Height)
End Sub
' NOPE
Private Sub mBase_Resize (Width As Int, Height As Int)
Log("mBase_Resize " & Width & " x " & Height)
End Sub
' ME NEITHER
Private Sub B4XPage_Resize (Width As Int, Height As Int)
Log("B4XPage_Resize " & Width & " x " & Height)
End Sub
' WORKS! However xPnl is what I want to resize when the window is resized
Private Sub xPnl_Resize (Width As Double, Height As Double)
Log("xPnl_Resize " & Width & " x " & Height)
End Sub
[\CODE]