Spanish ScrollPane en B4J [SOLUCIONADO]

IdasI4A

Active Member
Licensed User
Longtime User
Me podeis indicar por que este código funciona en B4A, pero da error en B4J.
B4X:
    Dim Pn As B4XView=xui.CreatePanel("")
    Dim Hay As Int

    Hay=ScrollView1.ScrollViewInnerPanel.NumberOfViews

    Pn.SetLayoutAnimated(0,0,0,ScrollView1.Width,40dip)
    Pn.LoadLayout("lyLabel")
   
    ScrollView1.ScrollViewInnerPanel.AddView(Pn,0,Hay*40dip,ScrollView1.Width,40dip)
    ScrollView1.ScrollViewContentHeight=(Hay+1)*40dip
   
    Dim Lbl As B4XView=Pn.GetView(0)
    Lbl.Text="Texto " & (Hay+1)
    Lbl.Color=xui.Color_Cyan

Da el error
java.lang.RuntimeException: Object should first be initialized (B4XView).
en la linea
Hay=ScrollView1.ScrollViewInnerPanel.NumberOfViews

Adjunto el proyecto por si quereis probar.
 

Attachments

  • Project.zip
    16.5 KB · Views: 228
Last edited:

IdasI4A

Active Member
Licensed User
Longtime User
Ya funciona Lo he solucionado añadiendo:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    #if b4j
    Dim pnScrollView1 As Pane
    pnScrollView1.Initialize( "")
    Dim Sv As ScrollPane
    Sv=ScrollView1
    Sv.InnerNode=pnScrollView1
    #end if
End Sub
 

Attachments

  • PruebaScroll.zip
    16.5 KB · Views: 283
Cookies are required to use this site. You must accept them to continue using the site. Learn more…