je voudrais afficher le nom du fichier choisi quand je clique dans le gadget listview.
Je ne comprends pas pourquoi ça ne marche pas !
Code : Tout sélectionner
; ------------------------------------------------------------
Fichiers Listing Excel
; ------------------------------------------------------------
;
Enumeration
#WindowWidth = 450
#WindowHeight = 305
EndEnumeration
Procedure Liste_dossier()
If ExamineDirectory(0, GetGadgetText(0), "*.xls*")
While NextDirectoryEntry(0)
FileName$ = DirectoryEntryName(0)
If DirectoryEntryType(0) = #PB_DirectoryEntry_Directory
FileName$ = "[DIR] "+FileName$
EndIf
AddGadgetItem(2, -1, FileName$)
Wend
Else
MessageRequester("Erreur","Impossible d'examiner le dossier: "+GetGadgetText(0),0)
EndIf
EndProcedure
If OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, "Sofetec - Fichiers Listing Excel")
StringGadget (0, 10, 10, 202, 24, GetCurrentDirectory())
ButtonGadget (1, 220, 10, 60 , 24, "List")
ListViewGadget(2, 10, 40, 270, 150)
StringGadget (4, 10, 195, 202, 24, "rien")
;ImageGadget (0, 200, 5, 0, 0, ImageID(2))
; SetGadgetText(4, "Initialisation Ok... Bienvenue !")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
ClearGadgetItems(2) ; Clear all the items found in the ListView
Liste_dossier()
Select EventGadget()
Case 1
MessageRequester("Information", "xxxxxx", 0)
Case 2
;SetGadgetText(2, "ViewGadget. Item selected: "+Str(GetGadgetState(2)))
If EventType() = #PB_EventType_LeftClick
MessageRequester("Information", "Doubleclick: item"+Str(GetGadgetState(2))+", Text: "+GetGadgetText(2) , 0)
ElseIf EventType() = 1
DisplayPopupMenu(0, WindowID(0))
EndIf
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
; End