B4J Question B4XDialog resize not catching - what am I missing?

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. The showing variable is not needed. Use dialog.Visible.

2. Dialog.Resize does indeed only center the dialog. I will add a comment about it.

You are looking for something like:
B4X:
' Called from Main.Mainform_Resize
Public Sub Resize(width As Double, height As Double)
    If dialog1.Visible Then
        Dim dx = width - dialog1.Base.Width, dy = height - dialog1.Base.Height As Int
        For i = 0 To dialog1.Base.NumberOfViews - 2 'the last view is the content view
            Dim v As B4XView = dialog1.Base.GetView(i)
            v.Left = v.Left + dx
            v.Top = v.Top + dy
        Next
        dialog1.Base.SetLayoutAnimated(0, 0, 0, width, height)
        dialog1.Resize(width, height)
        Dim ContentPanel As B4XView = dialog1.Base.GetView(dialog1.Base.NumberOfViews - 1)
        ContentPanel.SetLayoutAnimated(0, 0, 0, width, height - dialog1.ButtonsHeight - 3dip)
    End If
End Sub
 
Upvote 0
Top