B4J Question An example of using CLV on b4j

Reminisce

Active Member
Can anyone show me an example of how to load a pane to clv in b4j.

I know how to do this well in b4a, but my layout doesn't display well in b4j.

Any example will help.
 

Reminisce

Active Member

Using XUI.CreatePanel:
    For i = 0 To 10
        Dim p As B4XView = x.CreatePanel("p")
        p.Left=0
        p.Top = 0
        p.Width=100
        p.Height = 150
        p.LoadLayout("bookitemslayout")
        clvitems.Add(p,"")
        Log(i)
    Next

This is the issue, My Designer is actually anchored well, and it displays nice there.

But on Running,this is what i get...
 
Upvote 0

Reminisce

Active Member
B4X:
For i = 0 To 10
        Dim p As B4XView = x.CreatePanel("p")
        p.Left=0
        p.Top = 0
        p.Width=100
            p.LoadLayout("bookitemslayout")
        clvitems.Add(p,"")
        Log(i)
    Next



with the above code, it displays well.

But, My Loop returns just one panel. I attached a screenshot.
 
Upvote 0

Reminisce

Active Member
I have attached a sample project..


B4X:
    For i = 0 To 10
        Dim p As B4XView = x.CreatePanel("p")
        p.SetLayoutAnimated(0,0,10,100,150)
        p.LoadLayout("bookitemslayout")
        clvitems.Add(p,"")
        Sleep(0)
        
    Next

The Label itemname, itemprice, and txtitemquantity always jumps to the top..
 

Attachments

  • testproject.zip
    105.4 KB · Views: 258
Upvote 0

Revisable5987

Member
Licensed User
Its because of your designer script. Specifically, trying to do this:
B4X:
lblitemname.Top = Label1.Top +11%y

I recommend looking at the Visual Designer Video, it has a good section about designer script.

Also I've attached a modified project so you can see what I mean. Notice how this now allows the views to resize.
 

Attachments

  • testproject.zip
    105.4 KB · Views: 279
Upvote 0

Reminisce

Active Member
I'll test the attached project tomorrow, hopefully it works as expected. I know how to use the designer, I've been working with b4a and I've never heard any issue related to this. I guess b4j handles layouts differently. Thank you very much @kgcarpenter and @Erel for your time. ❀❀
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…