I don't use B4XPages, but the only way I could get it to work was.
1, Make Mainform in Main Public ( ie Dim MainForm .. not Private Mainform ...)
2, Change the FileChooser owner to Main.MainForm ( filename = fc.ShowOpen(Main.mainform) )
There are probably better ways , but who knows.
Edit:
@teddybear does