Sub AddLayoutToCustomView(EventName as String, cv As CustomListView,Layout Number As int) As Panel
Dim h As Int=0
Dim pnl As Panel
pnl.Initialize(EventName)
pnl.Width = 100%x
pnl.Height = 100%y
Select LayoutNumber
Case 0
pnl.LoadLayout("Layout0")
Case 1
pnl.LoadLayout("Layout1")
......
End Select
For Each vn As View In pnl.GetAllViewsRecursive
If vn.top+vn.Height>h And vn.Visible Then
h=vn.Height+vn.top
End If
Next
cv.Add(pnl,h,"0",False)
Return pnl
End Sub