J jnbarban Member Licensed User Longtime User Apr 26, 2011 #1 Hi , Dou you know How to list all views of tabhost ? i would like to resize by code all views on my tabHost. I do this for Activity : Code: Copy For i = 0 to Activity.NumberOfView -1 Dim MyView as View MyView = Activity.GetView(i) MyView.SetLayout(MyView.Left*Ratio, MyView.Top*Ratio, MyView.Width*Ratio, MyView.Height*Ratio) next This code Work but if i have a tabhost in my activity, All view of this tab host was not resized...
Hi , Dou you know How to list all views of tabhost ? i would like to resize by code all views on my tabHost. I do this for Activity : Code: Copy For i = 0 to Activity.NumberOfView -1 Dim MyView as View MyView = Activity.GetView(i) MyView.SetLayout(MyView.Left*Ratio, MyView.Top*Ratio, MyView.Width*Ratio, MyView.Height*Ratio) next This code Work but if i have a tabhost in my activity, All view of this tab host was not resized...
Erel B4X founder Staff member Licensed User Longtime User Apr 27, 2011 #2 Instead of adding the views to the TabHost directly with AddTab or AddTabWithIcon you should add the views to a Panel and then add the Panel to the TabHost with AddTab2 or AddTabWithIcon2. Then you will be able to iterate over the panels views. Upvote 0
Instead of adding the views to the TabHost directly with AddTab or AddTabWithIcon you should add the views to a Panel and then add the Panel to the TabHost with AddTab2 or AddTabWithIcon2. Then you will be able to iterate over the panels views.
Widget Well-Known Member Licensed User Longtime User Jul 27, 2011 #4 Erel said: Instead of adding the views to the TabHost directly with AddTab or AddTabWithIcon you should add the views to a Panel and then add the Panel to the TabHost with AddTab2 or AddTabWithIcon2. Then you will be able to iterate over the panels views. Click to expand... Hi Erel, I am just playing with TabHost for the first time and I can see the benefit of using a panel per page when you need to reference the Views. But why not just use the Designer to design a layout for each page of Tabhost and each of these layouts have their own panel like "pnlPage2". Then the user can still use the Designer to design each page and use AddTab or AddTabWithIcon to load the layout for the page. Otherwise wouldn't the user would have a stack of panels in the Designer or add all of the Views using code? Widget Upvote 0
Erel said: Instead of adding the views to the TabHost directly with AddTab or AddTabWithIcon you should add the views to a Panel and then add the Panel to the TabHost with AddTab2 or AddTabWithIcon2. Then you will be able to iterate over the panels views. Click to expand... Hi Erel, I am just playing with TabHost for the first time and I can see the benefit of using a panel per page when you need to reference the Views. But why not just use the Designer to design a layout for each page of Tabhost and each of these layouts have their own panel like "pnlPage2". Then the user can still use the Designer to design each page and use AddTab or AddTabWithIcon to load the layout for the page. Otherwise wouldn't the user would have a stack of panels in the Designer or add all of the Views using code? Widget
Erel B4X founder Staff member Licensed User Longtime User Jul 28, 2011 #5 Both options can work fine. Panels can load layouts themselves. So you can add the Panel by code and then call Panel.LoadLayout. Upvote 0
Both options can work fine. Panels can load layouts themselves. So you can add the Panel by code and then call Panel.LoadLayout.
Widget Well-Known Member Licensed User Longtime User Jul 28, 2011 #6 Erel said: Both options can work fine. Panels can load layouts themselves. So you can add the Panel by code and then call Panel.LoadLayout. Click to expand... Erel, That gives me an idea. I could have a large blank panel in the main activity with a small top panel that has buttons like "Home", "<" and ">" to act as a Navigator (see iPhone). The buttons would load in the Previous or Next layouts, much like a MS wizard. This gets rid of the large tabs in TabHost (as long as I name the Views properly) and allows me to have as many pages as I want. The next page can be called up conditional on some of the View value(s) in the current panel. Hmmm. By jove, I think I've got it. Widget Upvote 0
Erel said: Both options can work fine. Panels can load layouts themselves. So you can add the Panel by code and then call Panel.LoadLayout. Click to expand... Erel, That gives me an idea. I could have a large blank panel in the main activity with a small top panel that has buttons like "Home", "<" and ">" to act as a Navigator (see iPhone). The buttons would load in the Previous or Next layouts, much like a MS wizard. This gets rid of the large tabs in TabHost (as long as I name the Views properly) and allows me to have as many pages as I want. The next page can be called up conditional on some of the View value(s) in the current panel. Hmmm. By jove, I think I've got it. Widget