Why the Animated Window starts empty?

Just starting out? Need help? Post your questions and find answers here.
EaxVal
User
User
Posts: 14
Joined: Thu Sep 12, 2024 2:00 pm

Why the Animated Window starts empty?

Post by EaxVal »

This is the code for a small animated window with text in the center. The issue is that the text stays invisible when the window first appears and only becomes visible once it reaches the center of the screen!
Any suggestions will be greatly appreciated.

Code: Select all

Global.i WinWidth = 420
Global.i WinHeight = 320

If OpenWindow(0, 0, 0, winWidth, WinHeight, "Title", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   TextGadget(1, 94, 120, winWidth, 20, "HELP ME SHOWING MYSELF FROM START!")
    
  ExamineDesktops()
  finalX = (DesktopWidth(0) - winWidth) / 2
  finalY = (DesktopHeight(0) - winHeight) / 2
  Direction.s = "right-then-right"
  
  startX = DesktopWidth(0) : startY = finalY
  exitX = startX : exitY = startY
  
  For x = startX To finalX Step -5
    ResizeWindow(0, x, finalY, #PB_Ignore, #PB_Ignore)
    Delay(5)
  Next
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
          CloseWindow(0)
          Break
    EndSelect
  ForEver
EndIf

RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: Why the Animated Window starts empty?

Post by RASHAD »

Hi
Are you looking for Windows ToastNotification ?
Next is a simple one :D

Code: Select all

Global.i WinWidth = 420
Global.i WinHeight = 320

If OpenWindow(0, 0, 0, winWidth, WinHeight, "Title", #PB_Window_BorderLess | #PB_Window_ScreenCentered)
  SetWindowColor(0,0)
  TextGadget(1, 40, 120, winWidth, 20, "HELP ME SHOWING MYSELF FROM START!")
  SetGadgetColor(1,#PB_Gadget_BackColor,$0) 
  SetGadgetColor(1,#PB_Gadget_FrontColor,$FFFFFF) 
  ExamineDesktops()
  finalX = (DesktopWidth(0) - winWidth) / 2
  finalY = (DesktopHeight(0) - winHeight) / 2
  Direction.s = "right-then-right"
  
  startX = DesktopWidth(0) : startY = finalY
  exitX = startX : exitY = startY
  
  For x = startX To finalX Step -5
    ResizeWindow(0, x, finalY, #PB_Ignore, #PB_Ignore)
    UpdateWindow_(WindowID(0))
    Delay(5)
  Next
  Beep_(800,200)
  Delay(2000)
  Quit = 1
  Repeat
    Select WaitWindowEvent()
      Case #WM_CHAR
        If EventwParam() = 27
          Quit = 1
        EndIf
    EndSelect
  Until Quit = 1
EndIf


Egypt my love
EaxVal
User
User
Posts: 14
Joined: Thu Sep 12, 2024 2:00 pm

Re: Why the Animated Window starts empty?

Post by EaxVal »

UpdateWindow_(WindowID(0))

Much Appreciated Mr. RASHAD!
Post Reply