I have a designer layout that I only need to load when a user asks for it - once loaded it stays around for later use
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I use to do the following:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
But doing the above code kept giving me Warning #20 - was added with designer should not be initialized
I do not like over-riding warnings because I could miss something (and at 68+ I am missing a lot).
So I changed the code to this
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
     
NOW the new code works fine and gets rid of the Warning #20 but looks convoluted
What is the proper way to load a designer layout dynamically.
BobVal
			
			
			
				B4X:
			
		
		
		   Private sPI_Partners_Main                            As Panel
   Private    sPI_Partners_Panel                        As Panel
   Private        sPI_Partners_Title                    As Label
   Private        sPI_Partners_List                    As ListView
   Private        sPI_Partners_OK                       As ButtonI use to do the following:
			
				B4X:
			
		
		
		           If  sPI_Partners_Main.IsInitialized = False Then
               sPI_Partners_Main.Initialize("")
               mPlayerInfoPanel.AddView(sPI_Partners_Main, 0, 0, 100%x, 100%y)
         
               sPI_Partners_Main.LoadLayout("sPI_PartnersList")     
           end ifBut doing the above code kept giving me Warning #20 - was added with designer should not be initialized
I do not like over-riding warnings because I could miss something (and at 68+ I am missing a lot).
So I changed the code to this
			
				B4X:
			
		
		
		   If  sPI_Partners_Main.IsInitialized = False Then
               Dim  LoadPanel As Panel
                     
               LoadPanel.Initialize("")
               mPlayerInfoPanel.AddView(LoadPanel, 0, 0, 100%x, 100%y)
         
               LoadPanel.LoadLayout("sPI_PartnersList")         
               sPI_Partners_Main = LoadPanel.GetView(0)
  end ifNOW the new code works fine and gets rid of the Warning #20 but looks convoluted
What is the proper way to load a designer layout dynamically.
BobVal
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		