james_sgp Active Member Licensed User Longtime User Oct 21, 2022 #1 Hi all, I`m trying to add button array (in code) to a panel in a SD_XUIScrollView2D, if I don`t 'LoadLayout' the panel, I can't add the buttons. But the panel is scrollable, if I 'LoadLayout' i can then add the buttons, etc but it doesn't scroll. Would appreciate pointers to what I`m missing here? I have attached my sample app. Thanks, James Attachments Map Test1.zip Map Test1.zip 12.6 KB · Views: 288
Hi all, I`m trying to add button array (in code) to a panel in a SD_XUIScrollView2D, if I don`t 'LoadLayout' the panel, I can't add the buttons. But the panel is scrollable, if I 'LoadLayout' i can then add the buttons, etc but it doesn't scroll. Would appreciate pointers to what I`m missing here? I have attached my sample app. Thanks, James
Solution james_sgp Oct 21, 2022 Ok, great thanks...let me have a look. I see my problem I was trying to add the buttons to the panel, rather than the to scrollview. Thank you StarDust James
Ok, great thanks...let me have a look. I see my problem I was trying to add the buttons to the panel, rather than the to scrollview. Thank you StarDust James
Star-Dust Expert Licensed User Longtime User Oct 21, 2022 #2 If you want to scroll you have to change the size of the sliding panel inside the scrollView. B4X: Copy XUIScrollView1.PanelHeight=NewHeight XUIScrollView1.PanelWidth=NewWidth You add the hall_layout panel inside the scrollView by loading it with LoadLayout, but you don't change the size of the scrollView's internal panel. Also it is not necessary to load a panel with the LoadLayout, I did not understand what happens to you if you add buttons with AddView instead Upvote 0
If you want to scroll you have to change the size of the sliding panel inside the scrollView. B4X: Copy XUIScrollView1.PanelHeight=NewHeight XUIScrollView1.PanelWidth=NewWidth You add the hall_layout panel inside the scrollView by loading it with LoadLayout, but you don't change the size of the scrollView's internal panel. Also it is not necessary to load a panel with the LoadLayout, I did not understand what happens to you if you add buttons with AddView instead
james_sgp Active Member Licensed User Longtime User Oct 21, 2022 #3 Thanks, ur demo works as is. But i cant add the buttons to the panel (from code), cos it says panel is not initilised (if i dont't load the layout). Or maybe i ask a simpler question, in the example how to i add buttons from code to the scrolling panel? Last edited: Oct 21, 2022 Upvote 0
Thanks, ur demo works as is. But i cant add the buttons to the panel (from code), cos it says panel is not initilised (if i dont't load the layout). Or maybe i ask a simpler question, in the example how to i add buttons from code to the scrolling panel?
Star-Dust Expert Licensed User Longtime User Oct 21, 2022 #4 I removed the LoadLayout and inserted panels, no problem B4X: Copy ''xScrollView1.LoadLayout("layout2") For i= 1 To 10 Dim P As B4XView = xui.CreatePanel("") P.Color=xui.Color_Red xScrollView1.AddView(P,i*35dip,10dip,30dip,30dip) Next Attachments Sample2.zip Sample2.zip 17.7 KB · Views: 251 Last edited: Oct 21, 2022 Upvote 0
I removed the LoadLayout and inserted panels, no problem B4X: Copy ''xScrollView1.LoadLayout("layout2") For i= 1 To 10 Dim P As B4XView = xui.CreatePanel("") P.Color=xui.Color_Red xScrollView1.AddView(P,i*35dip,10dip,30dip,30dip) Next
james_sgp Active Member Licensed User Longtime User Oct 21, 2022 #5 Ok, great thanks...let me have a look. I see my problem I was trying to add the buttons to the panel, rather than the to scrollview. Thank you StarDust James Last edited: Oct 21, 2022 Upvote 0 Solution
Ok, great thanks...let me have a look. I see my problem I was trying to add the buttons to the panel, rather than the to scrollview. Thank you StarDust James