B4J Question Form.close => form doesn't close?

Cableguy

Expert
Licensed User
Longtime User
Hi guys, and girls...

I have a form (not mainform, at least I think that way) that I show from a class.
This form is set transparent, as it is to be used as a Splash Screen...

my AppStart is as follows:
B4X:
Sub AppStart (Form1 As Form, Args() As String)

    MainForm = Form1

    Wait For (StartIntro(SplashScrFadeInDurantion)) complete (result As Boolean)

    'I can do stuff here

    Wait For (EndIntro(SplashScrFadeOutDurantion)) complete (result As Boolean)

   

    Dim PagesManager As B4XPagesManager

    PagesManager.Initialize(MainForm)

End Sub

And my Splash Screen is Initialized as follows:
B4X:
Public Sub Initialize
    Dim mWidth As Double = fx.PrimaryScreen.MaxX
    Dim mHeight As Double = fx.PrimaryScreen.MaxY
    SplashScr.Initialize("SplashScreen", mWidth, mHeight)
    SplashScr.SetFormStyle("TRANSPARENT")
    SplashScr.BackColor = fx.Colors.Transparent
    SplashScr.RootPane.LoadLayout("splash")
End Sub

Then, My StartIntro/EndIntro Subs are simple calls to...
B4X:
Public Sub ShowSplashScreen(FadeIn As Boolean, Duration As Int)
    If FadeIn = True Then
        SplashScr.RootPane.Alpha = 0
        SplashScr.Show
        SplashScr.RootPane.SetAlphaAnimated(Duration, 1.0)
    Else
        SplashScr.Show
    End If
End Sub

Public Sub HideSplashScreen(FadeOut As Boolean, Duration As Int)
    If FadeOut = True Then
        Dim p As Pane = SplashScr.RootPane
        p.SetAlphaAnimated(Duration, 0)
        Wait For P_AnimationCompleted  
    End If
    SplashScr.Close
   
End Sub

Everything works as presumed except that the SplashScr Form is not Closed... as it is transparent I don't see it, but its still present in the taskbar, along with MainForm.
Why?
 

DonManfred

Expert
Licensed User
Longtime User
where and how did you set "P" as prefix for the Pane?
I guess the line
B4X:
Wait For P_AnimationCompleted
doesn´t get finished because there is no such event with "P" as prefix.
 
Upvote 1

Cableguy

Expert
Licensed User
Longtime User
where and how did you set "P" as prefix for the Pane?
P is a pane and panes do have an event for AnimationCompleted!
I even added the AnimationEvent to be sure it got completed, same thing
I even replaced that with a Sleep(Duration) but the result is the same

Dim p As Pane = SplashScr.RootPane
p.SetAlphaAnimated(Duration, 0)
Wait For P_AnimationCompleted
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
@DonManfred, You did however send me on the right track.
It seems that SetAlphaAnimated is NOT considered an animation, thus doesn't trigger the AnimationComplete event.

When I added just Sleep(Duration) the mainForm was not shown (I guess it didn't have the time to start... so, I added Sleep(duration + 500) it now works....
Sometimes it's the simplest things....
 
Upvote 0
Top