B4J Question am I wrong or..?

Gianni M

Well-Known Member
Licensed User
Longtime User
please, test this project
i put 5 B4XFloatTextField into Pane from code, and is OK
but resizing form, last B4XFloatTextField split at top
am I wrong or..?

(sorry for the bad english)
 

Attachments

Solution
It is usual to load the layout with a customview into a panel, then place the panel onto the target pane:

B4X:
    For i = 1 To 5
        Dim P As B4XView = xui.CreatePanel("")
        P.SetLayoutAnimated(0,0,0,240,50)
        P.LoadLayout("casella3")
        Pane1.AddNode(P,300,i*52,240,50)
        B4XFloatTextField1.Text = $"i am ${i+5} TextField"$
    Next

Your version does work if you disable Handle resize event in the layout. Although if the Customview has to respond to resizing (you use height or width anchors in the designer), you would then have to manage that yourself.
It is usual to load the layout with a customview into a panel, then place the panel onto the target pane:

B4X:
    For i = 1 To 5
        Dim P As B4XView = xui.CreatePanel("")
        P.SetLayoutAnimated(0,0,0,240,50)
        P.LoadLayout("casella3")
        Pane1.AddNode(P,300,i*52,240,50)
        B4XFloatTextField1.Text = $"i am ${i+5} TextField"$
    Next

Your version does work if you disable Handle resize event in the layout. Although if the Customview has to respond to resizing (you use height or width anchors in the designer), you would then have to manage that yourself.
 

Attachments

Upvote 0
Solution
perfect! work fine.

now, into Pane1 there are five B4XFloatTextField and question is:
how to remove only the third element ?
TextField 1
TextField 2
Empty
TextField 4
TextField 5
 
Upvote 0
do you like this solution?
Code:
For i=1 To 5
        Dim P As B4XView = xui.CreatePanel("")
        P.SetLayoutAnimated(0,0,0,240,50)
        P.LoadLayout("casella2")
        Pane1.AddNode(P,10,i*52,240,50)
        B4XFloatTextField1.Text = $"i am ${i} TextField"$
        B4XFloatTextField1.mBase.Tag = $"#|${i}"$ 'Tag Element
    Next
and remove
Code:
    For Each txt As B4XView In Pane1.GetAllViewsRecursive
        If txt.Tag = "#|3" Then
            txt.RemoveViewFromParent
        End If
    Next
 
Upvote 0
Back
Top