fermeture fenetre animée !!
Publié : ven. 09/avr./2004 11:17
de Dobro !
voila une petite fonction toute simple mais qui met du dynamisme
dans la fermeture de fenetres
cela donnera surement des idees a certains d'entre vous !

voila une petite fonction toute simple mais qui met du dynamisme
dans la fermeture de fenetres
cela donnera surement des idees a certains d'entre vous !
voilaDeclare winfx(type.s)
; on ouvre une fenetre
WindowID = OpenWindow(1, 50, 50, 200, 200, #PB_Window_SystemMenu , "hello")
WindowID = WindowID(1)
Repeat
event=WaitWindowEvent()
Until event=#PB_Event_CloseWindow
; *******************************
; ici on appel la fonction qui fait partir la fenetre
;winfx("larg")
;winfx("haut")
;winfx("elast")
;winfx("elast2")
winfx("go_gauche")
;winfx("go_droite")
;winfx("go_haut")
;winfx("go_bas")
Procedure winfx(type.s)
If vitesse<1
vitesse=1
EndIf
If vitesse>2
vitesse=2
EndIf
winx = WindowX()
winy = WindowY()
winhaut = WindowHeight()
winlarg = WindowWidth()
;la fenetre retreci la largeur
If type.s ="larg"
For cont=winlarg To 1 Step -2
ResizeWindow(cont, winhaut)
Next cont
EndIf
;la fenetre retreci la hauteur
If type.s ="haut"
For cont=winhaut To 1 Step -2
ResizeWindow(winlarg,cont)
Next cont
EndIf
;la fenetre elactic
If type.s ="elast"
For cont=winhaut To 1 Step -2
ResizeWindow(winlarg,cont)
Next cont
For cont=1 To winhaut
ResizeWindow(winlarg,cont)
Next cont
For cont=winhaut To 1 Step -2
ResizeWindow(winlarg,cont)
Next cont
EndIf
;la fenetre elactic2
For p=1 To 2
If type.s ="elast2"
For cont=winhaut To 1 Step -2
ResizeWindow(winlarg,cont)
Next cont
For cont=1 To winhaut Step 2
ResizeWindow(winlarg,cont)
Next cont
For cont=winhaut To 1 Step -2
ResizeWindow(winlarg,cont)
Next cont
EndIf
Next p
;la fenetre part a gauche
If type.s ="go_gauche"
; un petit coup a droite
For cont=winx To winx+100 Step 1
MoveWindow(cont,winy)
Next cont
For cont=winx To 0 Step -2
MoveWindow(cont,winy)
Next cont
EndIf
;la fenetre part a droite
If type.s ="go_droite"
; un petit coup a gauche
For cont=winx To winx-100 Step -1
MoveWindow(cont,winy)
Next cont
For cont=winx To 1024 Step 2
MoveWindow(cont,winy)
Next cont
EndIf
;la fenetre part en bas
If type.s ="go_bas"
For cont=winy To 800 Step 1
MoveWindow(winx,cont)
Next cont
EndIf
;la fenetre part en haut
If type.s ="go_haut"
For cont=winy To 0 Step -2
MoveWindow(winx,cont)
Next cont
EndIf
EndProcedure
