in this sub from erel to get Get Current Form
i create a sub to add a lotoff form but the problem that i can't check if it open or not
B4X:
Public Sub GetCurrentForm As Form
Dim UninitializedForm As Form
Dim x As JavaObject
Dim stage As JavaObject = x.InitializeStatic("anywheresoftware.b4a.objects.B4XViewWrapper$XUI").RunMethod("findActiveStage", Null)
If stage.IsInitialized = False Then Return UninitializedForm
Dim scene As JavaObject = stage.RunMethod("getScene", Null)
Dim pane As B4XView = scene.RunMethod("getRoot", Null)
Dim a As JavaObject
Return a.InitializeStatic("anywheresoftware.b4a.AbsObjectWrapper").RunMethodJO("getExtraTags", Array(pane)).RunMethod("get", Array("form"))
End Sub
B4X:
Dim frm As Form = GetCurrentForm
If frm.IsInitialized Then
Log(frm.Title)
End If
i create a sub to add a lotoff form but the problem that i can't check if it open or not
B4X:
Sub showForm(layout As String,event As String,Title As String,width As Int ,height As Int)
Dim frmshowing As Boolean=False
Dim frm As Form = GetCurrentForm
If frm.IsInitialized Then
Log("GetCurrentForm "&frm.Title)' the second form is open but get mainform title
If frm.Title=Title Then
Log("form is open")
frmshowing=True
Else
Log("form is not open")
frmshowing=False
End If
End If
If frmshowing = False Then
Dim FMF As Form
FMF.Initialize(event, width, height)
FMF.RootPane.LoadLayout(layout)
FMF.Title = Title
FMF.Show
End If