Page 1 of 1

Splash Screen Imaging NOT Showing? (SOLVED)

Posted: Tue Aug 02, 2011 11:37 am
by Nexus100
Hi All and thanks in advance!

Writing an application and want to add a splash screen. I have two issues:

1) I want the Splash Window to remain Focused and On Top so it stays visible no matter what

2) I have an image on the screen and it is not showing and I am not sure why?

Code: Select all

Procedure CreateSplashWindow()
    
    Protected GUIState = #False
    
    If OpenWindow(#SplashWindow,0,0,505,241,"",#PB_Window_Invisible|#PB_Window_BorderLess|#PB_Window_ScreenCentered|#WS_POPUP)
        ImageGadget(#SplashImage,10,10,405,141,ImageID(#GPLogo))
        SetGadgetState(#SplashImage,ImageID(#GPLogo))
        InvalidateRect_(GadgetID(#SplashImage),0,1)
        GUIState = #True
    Else
        GUIState = #False
    EndIf
    ProcedureReturn GUIState
EndProcedure
Any help much appreciated!

Re: Splash Screen Imaging NOT Showing?

Posted: Tue Aug 02, 2011 11:44 am
by DarkDragon
One problem: you don't ever call CreateSplashWindow.
Second problem: you don't have an event loop for this window.

Maybe you didn't post the full code? How should we help on that then?

Another problem: #PB_Window_Invisible without HideWindow(window, 0)

[EDIT]
It works .. but you don't need the invalidaterect:

Code: Select all

; Missing constants
Enumeration
  #SplashWindow
EndEnumeration

Enumeration
  #SplashImage
EndEnumeration

Enumeration
  #GPLogo
EndEnumeration

; Your code
Procedure CreateSplashWindow()
    
    Protected GUIState = #False
    
    If OpenWindow(#SplashWindow,0,0,505,241,"",#PB_Window_Invisible|#PB_Window_BorderLess|#PB_Window_ScreenCentered|#WS_POPUP)
        ImageGadget(#SplashImage,10,10,405,141,ImageID(#GPLogo))
        SetGadgetState(#SplashImage,ImageID(#GPLogo))
        InvalidateRect_(GadgetID(#SplashImage),0,1)
        GUIState = #True
    Else
        GUIState = #False
    EndIf
    
    ProcedureReturn GUIState
EndProcedure

; My code
Debug LoadImage(#GPLogo, #PB_Compiler_Home + "/examples/sources/data/geebee2.bmp")
If CreateSplashWindow()
  HideWindow(#SplashWindow, 0)
  Start = ElapsedMilliseconds()
  Repeat
  Until WaitWindowEvent(3) = #PB_Event_CloseWindow Or ElapsedMilliseconds() - Start > 3000
EndIf
End