dossier même si j'en sélectionnais 6.
pour les fichier pas de problème.
Code : Tout sélectionner
;{- Enumerations / DataSections
;{ Windows
Enumeration
#Window_0
EndEnumeration
;}
;{ Toolbars
Enumeration
#Toolbar_Window_0
EndEnumeration
;}
;{ Menu bars
Enumeration
#Menu_Window_0
EndEnumeration
;}
;{ Menu/Toolbar items
Enumeration
#Menu_Window_0_0_Couper
#Menu_Window_0_1_Coupier
#Menu_Window_0_2_Coller
#Menu_Window_0_3_Quitter
#Menu_Window_0_4_Aide
#Menu_Window_0_5_APropos
#Toolbar_Window_0_0_Copy
#Toolbar_Window_0_1_Cut
#Toolbar_Window_0_2_Paste
#Toolbar_Window_0_3_Properties
#Toolbar_Window_0_4_Help
EndEnumeration
;}
;{ Gadgets
Enumeration
#ExplorerCombo_0
#ExplorerList_1
#Button_2
#Button_3
#Button_4
EndEnumeration
;}
Global Disk$,Disk1$,Chemin$
Disk$ = "C:\"
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;}
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 524, 379, 485, 313, "Window_0", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
If CreateMenu(#Menu_Window_0, WindowID(#Window_0))
MenuTitle("Menu")
MenuItem(#Menu_Window_0_0_Couper, "Couper")
MenuItem(#Menu_Window_0_1_Coupier, "Coupier")
MenuItem(#Menu_Window_0_2_Coller, "Coller")
MenuBar()
MenuItem(#Menu_Window_0_3_Quitter, "Quitter")
MenuTitle("Aide")
MenuItem(#Menu_Window_0_4_Aide, "Aide")
MenuItem(#Menu_Window_0_5_APropos, "A Propos")
EndIf
If CreateToolBar(#Toolbar_Window_0, WindowID(#Window_0))
ToolBarStandardButton(#Toolbar_Window_0_0_Copy, #PB_ToolBarIcon_Copy)
ToolBarStandardButton(#Toolbar_Window_0_1_Cut, #PB_ToolBarIcon_Cut)
ToolBarStandardButton(#Toolbar_Window_0_2_Paste, #PB_ToolBarIcon_Paste)
ToolBarStandardButton(#Toolbar_Window_0_3_Properties, #PB_ToolBarIcon_Properties)
ToolBarStandardButton(#Toolbar_Window_0_4_Help, #PB_ToolBarIcon_Help)
EndIf
If CreateGadgetList(WindowID(#Window_0))
ExplorerComboGadget(#ExplorerCombo_0, 5, 30, 475, 100, "c:\")
ExplorerListGadget(#ExplorerList_1, 5, 60, 475, 190, "c:\",#PB_Explorer_MultiSelect);|#PB_Explorer_NoDirectoryChange) permet de ne pas changer de rep
ButtonGadget(#Button_2, 185, 265, 100, 20, "Couper")
ButtonGadget(#Button_3, 5, 265, 100, 20, "Copier")
ButtonGadget(#Button_4, 375, 265, 100, 20, "Coller")
EndIf
EndIf
EndProcedure
OpenWindow_Window_0()
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #ExplorerCombo_0
Disk$ = GetGadgetText(#ExplorerCombo_0)
SetGadgetText(#ExplorerList_1, GetGadgetText(#ExplorerCombo_0))
ElseIf EventGadget = #ExplorerList_1
If EventType() = #PB_EventType_LeftDoubleClick
; //////////////////////////
MessageRequester("Info",GetGadgetText(#ExplorerList_1) + GetGadgetItemText(#ExplorerList_1, GetGadgetState(#ExplorerList_1), 0),# MB_ICONINFORMATION)
; //////////////////////////
EndIf
ElseIf EventGadget = #Button_2
ElseIf EventGadget = #Button_3 ; pour copier des éléments sélectionnés
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If GetGadgetState(#ExplorerList_1) > -1 ; au moins un élément est sélectionné
CheminInitial$ = "C:\"
Chemin$ = PathRequester("Choisissez le répertoire de destination", CheminInitial$)
If Chemin$ ; un chemin a été choisi
For i = 0 To CountGadgetItems(#ExplorerList_1) - 1
If GetGadgetItemState(#ExplorerList_1, i) & #PB_Explorer_Selected ; un élément est sélectionné et c'est ...
Debug GetGadgetItemText(#ExplorerList_1, i, 0) + " est sélectionné"
If GetGadgetItemState(#ExplorerList_1, i) & #PB_Explorer_Directory ; ... un répertoire
Debug "CopyDirectory(" + GetGadgetText(#ExplorerList_1) + GetGadgetItemText(#ExplorerList_1, i, 0) + ", " + Chemin$ + ", " + #DQUOTE$ + "*.*" + #DQUOTE$ + " ,#PB_FileSystem_Recursive )"
CopyDirectory(GetGadgetText(#ExplorerList_1) + GetGadgetItemText(#ExplorerList_1, GetGadgetState(#ExplorerList_1), 0),Chemin$ + GetGadgetItemText(#ExplorerList_1, GetGadgetState(#ExplorerList_1), 0), "*.*" ,#PB_FileSystem_Recursive)
ElseIf GetGadgetItemState(#ExplorerList_1, i) & #PB_Explorer_File ; ... un fichier
Debug "CopyFile(" + GetGadgetText(#ExplorerList_1) + GetGadgetItemText(#ExplorerList_1, i, 0)+ ", " + Chemin$ + GetGadgetItemText(#ExplorerList_1, i, 0) + ") "
CopyFile(GetGadgetText(#ExplorerList_1) + GetGadgetItemText(#ExplorerList_1, i, 0), Chemin$ + GetGadgetItemText(#ExplorerList_1, i, 0))
EndIf
EndIf
Next
EndIf
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ElseIf EventGadget = #Button_4
EndIf
; /////////////////
Case #PB_Event_Menu
EventMenu = EventMenu()
If EventMenu = #Menu_Window_0_0_Couper
ElseIf EventMenu = #Menu_Window_0_1_Coupier
ElseIf EventMenu = #Menu_Window_0_2_Coller
ElseIf EventMenu = #Menu_Window_0_3_Quitter
ElseIf EventMenu = #Menu_Window_0_4_Aide
ElseIf EventMenu = #Menu_Window_0_5_APropos
ElseIf EventMenu = #Toolbar_Window_0_0_Copy
ElseIf EventMenu = #Toolbar_Window_0_1_Cut
ElseIf EventMenu = #Toolbar_Window_0_2_Paste
ElseIf EventMenu = #Toolbar_Window_0_3_Properties
ElseIf EventMenu = #Toolbar_Window_0_4_Help
EndIf
; ////////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver
;
;}
; jaPBe Version=3.7.7.649
; Build=0
; Language=0x0000 Language Neutral
; FirstLine=95
; CursorPosition=124
; ExecutableFormat=Windows
; DontSaveDeclare
; EOF
; jaPBe Version=3.7.7.650
; Build=0
; Language=0x0000 Language Neutral
; FirstLine=87
; CursorPosition=97
; ExecutableFormat=Windows
; DontSaveDeclare
; EOF