Splash Screen Imaging NOT Showing? (SOLVED)

Just starting out? Need help? Post your questions and find answers here.
User avatar
Nexus100
User
User
Posts: 55
Joined: Tue Feb 16, 2010 9:40 pm
Location: Essex, UK

Splash Screen Imaging NOT Showing? (SOLVED)

Post 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!
Last edited by Nexus100 on Tue Aug 02, 2011 12:26 pm, edited 1 time in total.
All watched over by MACHINES..I am little more than #DigitalPlankton
DarkDragon
Addict
Addict
Posts: 2348
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Splash Screen Imaging NOT Showing?

Post 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
bye,
Daniel
Post Reply