B4J Question [B4XPages] Show page has modal form (Blocking parent)


Active Member
Licensed User
Longtime User
Hi all,

I know B4XPages are meant to be non blocking, but I really need that a page is set to be a modal form (block the parent page until closed).
I have used form.ShowAndWait inside the B4XPage_Created which does what i want, but it shows 2 times the page, the first when form.ShowAndWait is called inside B4XPage_Created, and after i close it when it triggers B4XPage_Appear.

Is there a way to make a B4XPage modal without double triggering it's visibility?

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Dim form As Form = B4XPages.GetNativeParent(Me)   
    form.WindowWidth = 455dip
    form.WindowHeight = 210dip
    form.Icon = fx.LoadImage(File.DirAssets, "icon.png")
    form.AlwaysOnTop = True
    form.Resizable = False
    form.ShowAndWait    '<- Sets the form to modal, blocking the main window, but also shows 2x the form
End Sub
Tip: the UNIFIED theme no longer exists and the call is discarded.

Don't use a page for that case. Use a custom class with a Form and handle it yourself.