Basic Univers

; Fermeture Animée d'une fenêtre

;- Window Constants
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
Enumeration
  #Button_0
  #Button_1
  #Button_2
  #Button_3
  #Button_4
  #Button_5
  #Button_6
  #Button_7
  #Button_8
  #Button_9
  #_StringGadget0
  #Text_0
EndEnumeration

Procedure AnimationClose(Fenetre, Effet, Duree)
 AnimateWindow_(WindowID(Fenetre), Duree, Effet | #AW_HIDE)
EndProcedure

  If OpenWindow(#Window_0, 216, 0, 440, 140, "Api's test fermeture",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
    If CreateGadgetList(WindowID(#Window_0))
      ButtonGadget(#Button_0, 20, 20, 100, 30, "gauche a droite")
      ButtonGadget(#Button_1, 120, 20, 100, 30, "droite a gauche")
      ButtonGadget(#Button_2, 220, 20, 100, 30, "bas vers haut")
      ButtonGadget(#Button_3, 320, 20, 100, 30, "haut vers bas")
      ButtonGadget(#Button_4, 20, 50, 100, 30, "bas G haut D")
      ButtonGadget(#Button_5, 120, 50, 100, 30, "bas D haut G")
      ButtonGadget(#Button_6, 220, 50, 100, 30, "haut G bas D")
      ButtonGadget(#Button_7, 320, 50, 100, 30, "haut D bas G")
      ButtonGadget(#Button_8, 120, 80, 100, 30, "centre")
      ButtonGadget(#Button_9, 220, 80, 100, 30, "fondu")
      StringGadget(#_StringGadget0, 170,  115, 100, 20, "500")
      TextGadget(#Text_0, 20, 117, 250, 20, "entrée votre durée ici en mS:")
    EndIf
  EndIf
 
  Repeat
   EventID = WaitWindowEvent()
    If EventID = #PB_Event_Gadget
      Select EventGadget()
     
       Case #Button_0
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_HOR_POSITIVE, Val(Chaine$)) ; gauche a droite
         End
         
       Case #Button_1
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_HOR_NEGATIVE, Val(Chaine$)) ; droite a gauche
         End
     
       Case #Button_2
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_VER_NEGATIVE, Val(Chaine$)) ; bas vers haut
         End

       Case #Button_3
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_VER_POSITIVE, Val(Chaine$)) ; haut vers bas
         End
       
       Case #Button_4
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_HOR_POSITIVE|#AW_VER_NEGATIVE, Val(Chaine$)) ; bas G haut D
         End
       
       Case #Button_5
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_HOR_NEGATIVE|#AW_VER_NEGATIVE, Val(Chaine$)) ; bas D haut G
         End
       
       Case #Button_6
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_VER_POSITIVE|#AW_HOR_POSITIVE, Val(Chaine$)) ; haut G bas D
         End
       
       Case #Button_7
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_HOR_NEGATIVE|#AW_VER_POSITIVE, Val(Chaine$)) ; haut D bas G
         End
       
       Case #Button_8
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_CENTER, Val(Chaine$)) ; centre
         End
       
       Case #Button_9
       Chaine$ = GetGadgetText(#_StringGadget0)
        AnimationClose(#Window_0, #AW_BLEND, Val(Chaine$)) ; fondu
         End
       
      EndSelect
    EndIf
  Until EventID = #PB_Event_CloseWindow
  AnimationClose(#Window_0, #AW_CENTER, Val(Chaine$)) ; centre