Sub AnimateDialog (dlg As B4XDialog, FromEdge As String)
Dim base As B4XView = dlg.Base
Dim top As Int = base.Top
Dim left As Int = base.Left
Select FromEdge.ToLowerCase
Case "bottom"
base.Top = base.Parent.Height
Case "top"
base.Top = -base.Height
Case "left"
base.Left = -base.Width
Case "right"
base.Left = base.Parent.Width
End Select
base.SetLayoutAnimated(300, left, top, base.Width, base.Height)
End Sub