Page 1 of 1

Why the Animated Window starts empty?

Posted: Fri Apr 18, 2025 1:38 am
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


Re: Why the Animated Window starts empty?

Posted: Fri Apr 18, 2025 3:50 am
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



Re: Why the Animated Window starts empty?

Posted: Fri Apr 18, 2025 5:29 am
by EaxVal
UpdateWindow_(WindowID(0))

Much Appreciated Mr. RASHAD!