hub73 Active Member Licensed User Longtime User Apr 6, 2016 #1 Hi ! I use a spinner and a panel to choose a layout to display. B4X: sub spinner_itemclick() select ... case "one" panel.loadlayout ("one") case "two" panel.loadlayout ("two") end select ... end sub Should i free the previous loaded panel when i load a new .bal ? How to do this ? (clear the previous panel bal below) Thanks.
Hi ! I use a spinner and a panel to choose a layout to display. B4X: sub spinner_itemclick() select ... case "one" panel.loadlayout ("one") case "two" panel.loadlayout ("two") end select ... end sub Should i free the previous loaded panel when i load a new .bal ? How to do this ? (clear the previous panel bal below) Thanks.
johndb Active Member Licensed User Longtime User Apr 6, 2016 #2 hub73 said: Hi ! I use a spinner and a panel to choose a layout to display. B4X: sub spinner_itemclick() select ... case "one" panel.loadlayout ("one") case "two" panel.loadlayout ("two") end select ... end sub Should i free the previous loaded panel when i load a new .bal ? How to do this ? (clear the previous panel bal below) Thanks. Click to expand... I would initialize the panel object prior to entering the "select/case" code structure. In that way, you are assured of having a fresh panel. John Upvote 0
hub73 said: Hi ! I use a spinner and a panel to choose a layout to display. B4X: sub spinner_itemclick() select ... case "one" panel.loadlayout ("one") case "two" panel.loadlayout ("two") end select ... end sub Should i free the previous loaded panel when i load a new .bal ? How to do this ? (clear the previous panel bal below) Thanks. Click to expand... I would initialize the panel object prior to entering the "select/case" code structure. In that way, you are assured of having a fresh panel. John
somed3v3loper Well-Known Member Licensed User Longtime User Apr 6, 2016 #3 B4X: panel.RemoveAllViews panel.loadlayout ("layoutname") ? Upvote 0
johndb Active Member Licensed User Longtime User Apr 6, 2016 #4 somed3v3loper said: B4X: panel.RemoveAllViews panel.loadlayout ("layoutname") ? Click to expand... panel.initialize ("eventname") panel.loadlayout ("layoutname") Upvote 0
somed3v3loper said: B4X: panel.RemoveAllViews panel.loadlayout ("layoutname") ? Click to expand... panel.initialize ("eventname") panel.loadlayout ("layoutname")
klaus Expert Licensed User Longtime User Apr 6, 2016 #5 johndb said: panel.initialize ("eventname") Click to expand... Oh no. B4X: Sub Spinner_ItemClick() Panel.RemoveAllViews Select ... Case "one" Panel.loadlayout ("one") Case "two" Panel.loadlayout ("two") End Select ... End Sub Upvote 0
johndb said: panel.initialize ("eventname") Click to expand... Oh no. B4X: Sub Spinner_ItemClick() Panel.RemoveAllViews Select ... Case "one" Panel.loadlayout ("one") Case "two" Panel.loadlayout ("two") End Select ... End Sub
johndb Active Member Licensed User Longtime User Apr 6, 2016 #6 klaus said: Oh no. B4X: Sub Spinner_ItemClick() Panel.RemoveAllViews Select ... Case "one" Panel.loadlayout ("one") Case "two" Panel.loadlayout ("two") End Select ... End Sub Click to expand... Why not just reinitialize the panel to remove all the previous views and reset the object? Upvote 0
klaus said: Oh no. B4X: Sub Spinner_ItemClick() Panel.RemoveAllViews Select ... Case "one" Panel.loadlayout ("one") Case "two" Panel.loadlayout ("two") End Select ... End Sub Click to expand... Why not just reinitialize the panel to remove all the previous views and reset the object?
klaus Expert Licensed User Longtime User Apr 6, 2016 #7 Why not just reinitialize the panel to remove all the previous views and reset the object? Click to expand... Because you initialize each time a new object, the previous ones remain with their layout ! Upvote 0
Why not just reinitialize the panel to remove all the previous views and reset the object? Click to expand... Because you initialize each time a new object, the previous ones remain with their layout !
johndb Active Member Licensed User Longtime User Apr 6, 2016 #8 klaus said: Because you initialize each time a new object, the previous ones remain with their layout ! Click to expand... @klaus Thank you for the clarification. I was under the assumption that if you reinitialized an object using the same variable name it wouldn't create a new object but reset the previous object by releasing all of its children (views). Last edited: Apr 6, 2016 Upvote 0
klaus said: Because you initialize each time a new object, the previous ones remain with their layout ! Click to expand... @klaus Thank you for the clarification. I was under the assumption that if you reinitialized an object using the same variable name it wouldn't create a new object but reset the previous object by releasing all of its children (views).