My problem is the fly-in and fly-out animation - its to fast. So my question is: how to smooth animate a window?
Code: Select all
#tWnd = 0
Define w, h
Procedure Close_Toast()
Protected n, w, h, y
If IsWindow(#tWnd)
ExamineDesktops()
w = DesktopWidth(0)
h = DesktopHeight(0)
UnbindEvent(#PB_Event_Timer, @Close_Toast(), #tWnd)
RemoveWindowTimer(#tWnd, #tWnd)
y = WindowY(#tWnd)
For n = y To h
ResizeWindow(#tWnd, #PB_Ignore, n, #PB_Ignore, #PB_Ignore)
Next
CloseWindow(#tWnd)
EndIf
EndProcedure
Procedure Show_Toast()
Protected w, h, y, n
ExamineDesktops()
w = DesktopWidth(0)
h = DesktopHeight(0)
If IsWindow(#tWnd) = 0
OpenWindow(#tWnd, w/4, h + 200, w/2, 200, "Toast", #PB_Window_TitleBar)
TextGadget(0, 0, 0, WindowWidth(#tWnd), WindowHeight(#tWnd), "<p>Some importend text here</p>")
BindEvent(#PB_Event_Timer, @Close_Toast(), #tWnd)
AddWindowTimer(#tWnd, #tWnd, 5000)
y = h - WindowHeight(#tWnd) - 50
For n = h To y Step -1
ResizeWindow(#tWnd, #PB_Ignore, n, #PB_Ignore, #PB_Ignore)
Next
EndIf
EndProcedure
Show_Toast()