ExplorerListGadget [RESOLU]
Publié : mar. 10/juil./2007 13:53
Salut tous le monde, je voulais savoir si on pouvait executer un fichier présent dans un ExplorerListGadget. En gros je veut charger le contenue d'un répertoir ou d'un disque et pouvoir executer un fichier en double cliquant dessus, c possible ? car je ne trouve pas de commande dans l'aide de PB pour l'ExplorerListGadget. A moin que je n'utilise pas le bon gadget.
Voici un exemple de source.
Voici un exemple de source.
Code : Tout sélectionner
;{- Enumerations / DataSections
;{ Windows
a$ = "a:\"
c$ = "c:\"
Enumeration
#Window_0
EndEnumeration
;}
;{ Gadgets
Enumeration
#ExplorerList_0
#Button_1
#Button_2
EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;}
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 450, 200, 400, 238, "Test.", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If CreateGadgetList(WindowID(#Window_0))
ExplorerListGadget(#ExplorerList_0, 0, 0, 390, 195, "c:\")
ButtonGadget(#Button_1, 5, 200, 150, 20, "A:")
ButtonGadget(#Button_2, 160, 200, 150, 20, "C:")
EndIf
EndIf
EndProcedure
OpenWindow_Window_0()
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #ExplorerList_0
ElseIf EventGadget = #Button_1
SetGadgetText(#ExplorerList_0, a$)
ElseIf EventGadget = #Button_2
SetGadgetText(#ExplorerList_0, c$)
EndIf
; ////////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver
;
;}