J JaunLukePicard Member Licensed User Longtime User Sep 15, 2015 #1 I am finding that it is MUCH easier to create a layout and load it in the Activity as opposed to writing a tone of code depending on how many Views that are on a particular screen. If, for example, I have a standard Designer layout I have built, but want to add some custom views to it before it is shown to the user what are the steps to do this in B4A? In this case I have a class that creates a ScrollView2d Table. The layout I have built has the buttons I want to display for the layout. I am doing it this way because I may use the ScrollView2d several times for different tables. So I thought of doing the following in code which would create the Panel, show the table via ScrollView2d and then load the layout to show the buttons. Here is the section of code I have... Code: Copy pnlTable.Initialize("pnlTable") Activity.AddView(pnlTable, 20dip, 20dip, 100%x - 40dip, 100%y - 90dip) pnlTable.LoadLayout("scnMain") What I end up with is the table only without the buttons at the bottom.
I am finding that it is MUCH easier to create a layout and load it in the Activity as opposed to writing a tone of code depending on how many Views that are on a particular screen. If, for example, I have a standard Designer layout I have built, but want to add some custom views to it before it is shown to the user what are the steps to do this in B4A? In this case I have a class that creates a ScrollView2d Table. The layout I have built has the buttons I want to display for the layout. I am doing it this way because I may use the ScrollView2d several times for different tables. So I thought of doing the following in code which would create the Panel, show the table via ScrollView2d and then load the layout to show the buttons. Here is the section of code I have... Code: Copy pnlTable.Initialize("pnlTable") Activity.AddView(pnlTable, 20dip, 20dip, 100%x - 40dip, 100%y - 90dip) pnlTable.LoadLayout("scnMain") What I end up with is the table only without the buttons at the bottom.
Erel B4X founder Staff member Licensed User Longtime User Sep 16, 2015 #2 You don't need to do anything special. Load the layout and then add the views in your code. The layout will only be visible when the message queue is processed after your code completes. Upvote 0
You don't need to do anything special. Load the layout and then add the views in your code. The layout will only be visible when the message queue is processed after your code completes.
J JaunLukePicard Member Licensed User Longtime User Sep 17, 2015 #3 Earl, Yes you are correct. I just figured it out. Sometimes we think that things are harder then they really are. Attached ut the code that worked... Code: Copy pnlTable.Initialize("") Activity.LoadLayout("scnMain") Activity.AddView(pnlTable, 20dip, 20dip, 100%x - 40dip, 100%y - 90dip) Upvote 0
Earl, Yes you are correct. I just figured it out. Sometimes we think that things are harder then they really are. Attached ut the code that worked... Code: Copy pnlTable.Initialize("") Activity.LoadLayout("scnMain") Activity.AddView(pnlTable, 20dip, 20dip, 100%x - 40dip, 100%y - 90dip)