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

  • caselle.zip
    3.3 KB · Views: 68
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.

stevel05

Expert
Licensed User
Longtime User
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

  • casellesl.zip
    4.6 KB · Views: 61
Upvote 0
Solution

Gianni M

Well-Known Member
Licensed User
Longtime User
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

stevel05

Expert
Licensed User
Longtime User
If you want to remove the view and change the positions of the other views, you would be better to put them in a CustomListView.
 

Attachments

  • casellesl2.zip
    6 KB · Views: 64
Upvote 0

Gianni M

Well-Known Member
Licensed User
Longtime User
do you like this solution?
B4X:
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
B4X:
    For Each txt As B4XView In Pane1.GetAllViewsRecursive
        If txt.Tag = "#|3" Then
            txt.RemoveViewFromParent
        End If
    Next
 
Upvote 0
Top