Bug With TabHost in B4A 1.50

jnbarban

Member
Licensed User
Longtime User
Hi, i think i have found a bug with TabHost.AddTab2() function.

i have 6 panel and 1 TabHost. I do that :

B4X:
pnl_Visite.LoadLayout("pnlVisite_Visite.bal")
pnl_Devenir.LoadLayout("pnlVisite_Devenir.bal")
pnl_Decouverte.LoadLayout("pnlVisite_Decouverte.bal")   
pnl_PresProd.LoadLayout("pnlVisite_PresentationProduit.bal")
pnl_Historique.LoadLayout("pnlVisite_Historique.bal")
pnl_Commentaire.LoadLayout("pnlVisite_Commentaires.bal")
      
tbh_Visite.AddTab2("Visite",pnl_Visite)
tbh_Visite.AddTab2("Devenir",pnl_Devenir)
tbh_Visite.AddTab2("Decouverte",pnl_Decouverte)   
tbh_Visite.AddTab2("PresentationProduit",pnl_PresProd)
tbh_Visite.AddTab2("Historique",pnl_Historique)
tbh_Visite.AddTab2("Commentaires",pnl_Commentaire)

It's Work great before Version 1.50 of B4A. Since 1.50, When Code passed on the first ligne "AddTab2", the associate panel = "N/A" ( i saw that with Debug mode)

ex : Before this line :

B4X:
tbh_Visite.AddTab2("Visite",pnl_Visite)

"pnl_Visite" = (BALayout) , Left = ..., Top = ...

After the line :

"pnl_Visite" = "N/A"

?????????????
 
Last edited:

jnbarban

Member
Licensed User
Longtime User
sorry but i don't think that it only affects the debug message because after doing this :

B4X:
pnl_Visite.LoadLayout("pnlVisite_Visite.bal")
   pnl_Devenir.LoadLayout("pnlVisite_Devenir.bal")
   pnl_Decouverte.LoadLayout("pnlVisite_Decouverte.bal")   
   pnl_PresProd.LoadLayout("pnlVisite_PresentationProduit.bal")
   pnl_Historique.LoadLayout("pnlVisite_Historique.bal")
   pnl_Commentaire.LoadLayout("pnlVisite_Commentaires.bal")
   
   tbh_Visite.AddTab2("Visite",pnl_Visite)
   tbh_Visite.AddTab2("Devenir",pnl_Devenir)
   tbh_Visite.AddTab2("Decouverte",pnl_Decouverte)   
   tbh_Visite.AddTab2("PresentationProduit",pnl_PresProd)
   tbh_Visite.AddTab2("Historique",pnl_Historique)
   tbh_Visite.AddTab2("Commentaires",pnl_Commentaire)

i do this :

B4X:
RedimensionnerPanel(pnl_Visite)

This Sub resize all view on my panel like that :

B4X:
Sub RedimensionnerPanel( MonPanel As Panel) 
   Log("Panel ---------------------------- :" & MonPanel)

   For i = 0 To MonPanel.NumberOfViews -1
      Dim vView As View
      vView = MonPanel.GetView(i)
      vView.SetLayout(Floor(vView.Left*Main.gXRatio),Floor(vView.Top*Main.gYRatio),Floor(vView.Width*Main.gXRatio),Floor(vView.Height*Main.gYRatio))
      Log("vView : " & vView)
      Dim NomView As String
      NomView = vView
      If NomView.indexOf("EditText") > -1 Then
         Dim txb_TextBox As EditText
         txb_TextBox = vView
         txb_TextBox.TextSize = txb_TextBox.TextSize * Main.gYRatio
      End If
      If NomView.indexOf("TextView") > -1 Then
         Dim lbl_Label As Label
         lbl_Label = vView
         lbl_Label.TextSize = lbl_Label.TextSize * Main.gYRatio
      End If
      If NomView.indexOf("BALayout") > -1 Then
         Dim pnl_panel As Panel
         pnl_panel = vView
         RedimensionnerPanel(pnl_panel)
      End If
      If NomView.indexOf("ScrollView") > -1 Then
         Dim scv_ScrollView As ScrollView
         scv_ScrollView = vView
         RedimensionnerScrollView(scv_ScrollView)
      End If
   Next

End Sub

And the application crash on ligne :
B4X:
Log("Panel ---------------------------- :" & MonPanel)

Error Message :

B4X:
java.lang.classCastException : android.widget.FrameLayout$LayoutParams
 
Top