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.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1595764093769.png
 
Upvote 0

Reminisce

Active Member
Capture.JPG
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

Capture.JPG

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..

Capture.JPG
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: 256
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: 277
Upvote 0

Reminisce

Active Member
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.
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
Top