Da die Version von FluidByte mit Callback und Timer bei mir unschöne Effekte hervorruft,
hab ich mich mal versucht, das anders zu lösen. (War einfacher als ich dachte...)
Die Funktion ist an HideWindow() orientiert.
Sieht allerdings nur mit Rahmenlosen Fenstern gut aus. (Rahmen bleibt während der Animation immer sichtbar)
Durch auskommentieren der #CompileAsUserlib bei Tailbite erhält man die IDE-Debug Funktion.
(Reagiert nur auf vorhandensein des Fensters)
Hier die "HideWindowAnim.pb"
Code: Alles auswählen
;@____________________________________________________________________________
; »»» Projekt : HideWindowAnim()
; »»» Versteckt oder zeigt ein vorhandenes Window mit
; »»» AnimateWindow_()
; »»» Author : George Bisonte
; »»» Date : 05 Aug, 2012
; »»» OS : WindowsOnly
; »»» PB : V4.61
; »»» CPU : x86,x64
; »»» Unicode : ja
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
EnableExplicit
;
; Wenn diese Include als oder in eine(r) Userlib genutzt werden soll,
; folgende Zeile auskommentieren um DEBUG Funktionen zu erhalten (Nur TailBite)
; #CompileAsUserlib = #True
;
CompilerIf Defined(CompileAsUserlib, #PB_Constant) = #True
CompilerIf #CompileAsUserlib = #True
XIncludeFile #PB_Compiler_Home+"TailBite/Helper Libraries/TB_Debugger.pb"
CompilerEndIf
CompilerEndIf
; ____________________________________________________________________________
; »»» Intern
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Procedure priv_HideWindowAnim(Window, State, AnimFlags = #AW_BLEND, Delay = 200) ; Hides or show the specified Window with an animation (>Win2000)
; Versteckt oder zeigt ein vorhandenes Window mit AnimateWindow_()
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms632669%28v=vs.85%29.aspx
; Funktion benötig Windows 2000 oder höher
; mögliche "Anim" Konstanten, die m.o.w auch kombinierbar sind
; #AW_BLEND
; #AW_CENTER
; #AW_HOR_NEGATIVE
; #AW_HOR_POSITIVE
; #AW_SLIDE
; #AW_VER_NEGATIVE
; #AW_VER_POSITIVE
; #AW_ACTIVATE gibt nach der Animation dem Fenster den Fokus,
; wie ein SetActiveWindow() in PB
; Das Delay wird in Millisekunden angegeben, Microsoft empfiehlt 200ms
; und nebenbei ist es der Prozedur egal, ob eine WindowID oder eine
; PB Window Nummer angegeben wird...
; um zwei Prozeduren zu vermeiden (ShowWindowWithAnim z.B.) habe ich die HideWindow()
; "Philosophie" übernommen ;)
Protected hWnd = #False, Result
If OSVersion()>=#PB_OS_Windows_2000
If IsWindow_(Window)
hWnd = Window
Else
If IsWindow(Window)
hWnd = WindowID(Window)
EndIf
EndIf
If hWnd
If State = #True
AnimFlags = AnimFlags|#AW_HIDE
Else
AnimFlags = AnimFlags|#AW_ACTIVATE
EndIf
AnimateWindow_(hWnd, Delay, AnimFlags)
EndIf
EndIf
EndProcedure
; ____________________________________________________________________________
; »»»
; »»» Externe Funktionen
; »»»
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CompilerIf Defined(CompileAsUserlib, #PB_Constant) = #True
CompilerIf #CompileAsUserlib = #True
ProcedureDLL HideWindowAnim(Window, State) ; Hides or show the specified Window with an animation (>Win2000)
ProcedureReturn priv_HideWindowAnim(Window, State, #AW_BLEND, 200)
EndProcedure
ProcedureDLL HideWindowAnim2(Window, State, AnimFlags) ; Hides or show the specified Window with an animation (>Win2000)
ProcedureReturn priv_HideWindowAnim(Window, State, AnimFlags, 200)
EndProcedure
ProcedureDLL HideWindowAnim3(Window, State, AnimFlags, Delay) ; Hides or show the specified Window with an animation (>Win2000)
ProcedureReturn priv_HideWindowAnim(Window, State, AnimFlags, Delay)
EndProcedure
CompilerEndIf
CompilerElse
ProcedureDLL HideWindowAnim(Window, State, AnimFlags = #AW_BLEND, Delay = 200) ; Hides or show the specified Window with an animation (>Win2000)
ProcedureReturn priv_HideWindowAnim(Window, State, AnimFlags, Delay)
EndProcedure
CompilerEndIf
; ____________________________________________________________________________
; »»» Debug Funktionen
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CompilerIf Defined(CompileAsUserlib, #PB_Constant) = #True
CompilerIf #CompileAsUserlib = #True
ProcedureCDLL HideWindowAnim_DEBUG(Window, State)
Protected hWnd
If IsWindow_(Window)
hWnd = Window
Else
If IsWindow(Window)
hWnd = WindowID(Window)
EndIf
EndIf
If Not hWnd
TB_DebugError("Window is not initialized")
EndIf
EndProcedure
ProcedureCDLL HideWindowAnim2_DEBUG(Window, State, AnimFlags)
Protected hWnd
If IsWindow_(Window)
hWnd = Window
Else
If IsWindow(Window)
hWnd = WindowID(Window)
EndIf
EndIf
If Not hWnd
TB_DebugError("Window is not initialized")
EndIf
EndProcedure
ProcedureCDLL HideWindowAnim3_DEBUG(Window, State, AnimFlags, Delay)
Protected hWnd
If IsWindow_(Window)
hWnd = Window
Else
If IsWindow(Window)
hWnd = WindowID(Window)
EndIf
EndIf
If Not hWnd
TB_DebugError("Window is not initialized")
EndIf
EndProcedure
CompilerEndIf
CompilerEndIf
;
DisableExplicit
Code: Alles auswählen
CompilerIf Defined(HideWindowAnim, #PB_Function) = #False
XIncludeFile "HideWindowAnim.pb"
CompilerEndIf
OpenWindow(0,200,300,300,250,"TestWindow",#PB_Window_BorderLess|#PB_Window_ScreenCentered|#PB_Window_Invisible)
For i=10 To 200 Step 40 : ButtonGadget(i, 50, i, 200, 30, "Schliesse Window") : Next i
HideWindowAnim(0, #False) ; Zeigt die Default Animation
;HideWindowAnim(0, #False, #AW_HOR_POSITIVE|#AW_VER_POSITIVE, 200) ; Zeigt die Animation von Links oben nach rechts unten
;HideWindowAnim(0, #False, #AW_CENTER 200) ; Zeigt die Animation von der Mitte nach Aussen
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Quit = 1
EndSelect
Until Quit > 0
HideWindowAnim(0, #True)
sieht aber auch unschön aus (weil das Window leicht hüpft, die Titelzeile verschwindet ja mit

aber dann wüsste ich nicht, wie man den Rahmen und die Titelzeile wieder hinkriegt....