Can any one tell me what is wrong with this code snippet. When i run it i only get a blank screen. But the menu items are available
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim kbPanel As Panel
Dim svOrders As ScrollView
svOrders.Initialize(180)
kbPanel.Initialize("")
Activity.AddView(kbPanel,100%x, 0,100%x,100%y)
kbPanel.LoadLayout("scr3")
Activity.AddView(svOrders,0,330,400,180)
Activity.AddMenuItem("Customers", "mnuCustomers")
Activity.AddMenuItem("Catalogues", "mnuCatalogues")
Activity.AddMenuItem("TempPics", "mnuPicsTemp")
End Sub
I still don't understand why i am loading Activity.LoadLayout("scr3") after loading the panel. Can you post a pointer where i could read something that explains this
The activity must have a layout and it should be loaded, but as you add all your views by code, the layout may be the minimal content - just the activity. It doesn't make sense to load the same layout for both activity and panel.
give tha activity layout another name.
I tried that and it does not show, However it IS there. I know it is because when i hold the tablet at a certain angle i can see the outline or a shadow of the panel in that position.
Sub Activity_Create(FirstTime As Boolean)
Dim kbPanel As Panel
Dim svOrders As ScrollView
svOrders.Initialize(180)
kbPanel.Initialize("")
kbPanel = svOrders.Panel
kbPanel.LoadLayout("scr3")
Activity.AddView(svOrders,0,330,400,180)
Activity.AddMenuItem("Customers", "mnuCustomers")
Activity.AddMenuItem("Catalogues", "mnuCatalogues")
Activity.AddMenuItem("TempPics", "mnuPicsTemp")
End Sub
or
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim svOrders As ScrollView
svOrders.Initialize(180)
svOrders.Panel.LoadLayout("scr3")
Activity.AddView(svOrders,0,330,400,180)
Activity.AddMenuItem("Customers", "mnuCustomers")
Activity.AddMenuItem("Catalogues", "mnuCatalogues")
Activity.AddMenuItem("TempPics", "mnuPicsTemp")
End Sub
The layout must be set to the internal panel of the ScrollView.
You must perhaps adjust the height of the internal panel to the height of the layout. With svOrders.Panel.Height = xxx.
Or if it is allready defined with svOrders.Initialize(xxx).