[Résolu] Pb d'utilisation ExplorerListGadget()

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
DarkIchigo
Messages : 62
Inscription : lun. 22/mars/2010 11:34

[Résolu] Pb d'utilisation ExplorerListGadget()

Message par DarkIchigo »

Bonjour a tous,

J'ai un soucis avec mon ExplorerListGadget(), je voudrai qu'il me Debug le chemin du dossier que j'ouvre quand je double clic dessus. Or le problème est que soit :
- il me debug 2 fois le même dossier à chaque fois que je sélectionne ou double clic sur un dossier
- soit si j'utilise un #PB_EventType_LeftDoubleClick il ne me prend en compte pas le dossier comme
un élément et il ne se passe donc rien.

Il doit surement y a voir un moyen mais j'avoue je trouve pas là.

Merci de votre aide.

Code : Tout sélectionner

Global Left_Combo$ = "C:\"

#Flag = #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_WindowCentered|#PB_Window_Maximize
#Flag_XplorerList = #PB_Explorer_AlwaysShowSelection|#PB_Explorer_FullRowSelect|#PB_Explorer_NoDriveRequester


Global NewList History.s()
T_x_Window = 1440
T_y_Window = 820

Procedure Historing(iLocation$)
	If FileSize(iLocation$) < 0
		AddElement(History()) : History() = iLocation$
		Debug History()
	EndIf	
EndProcedure

OpenWindow(0, 0, 0, T_x_Window, T_y_Window, "Double Xplorer", #Flag)

	ExplorerComboGadget(11, 5, 38, (T_x_Window/2)-9, T_y_Window-39-40, Left_Combo$, #PB_Explorer_Editable)
	ExplorerListGadget(12, 6, 63, (T_x_Window/2)-9, T_y_Window-95, Left_Combo$, #Flag_XplorerList)
		SetGadgetItemAttribute(12, 0, #PB_Explorer_ColumnWidth, 400, 0)
		SetGadgetItemAttribute(12, 0, #PB_Explorer_ColumnWidth, 95, 1)
		SetGadgetItemAttribute(12, 0, #PB_Explorer_ColumnWidth, 95, 2)
		SetGadgetItemAttribute(12, 0, #PB_Explorer_ColumnWidth, 117, 3)
	
Quit = 0
Repeat
	Event = WaitWindowEvent()
	Select EventWindow()
	Case 0
		Select Event
		Case #PB_Event_CloseWindow : Quit = 1
		
		Case #PB_Event_Gadget
      	Select EventGadget()
			Case 11
				Path_Left_Combo$ = GetGadgetText(11)
				SetGadgetText(12, Path_Left_Combo$)
			Case 12
				Path_Left_XplorerList$ = GetGadgetText(12)
				SetGadgetText(11, Path_Left_XplorerList$)
					posL = GetGadgetState(12)
					File_Left_XplorerList$ = GetGadgetItemText(12, posL)
					
					If EventType() = #PB_EventType_LeftDoubleClick
						If FileSize(Path_Left_XplorerList$+File_Left_XplorerList$) < 0
							Historing(Path_Left_XplorerList$+File_Left_XplorerList$)
						Else
							RunProgram(Path_Left_XplorerList$+File_Left_XplorerList$)
						EndIf
					EndIf
			EndSelect
		EndSelect
		
	EndSelect
Until Quit = 1
Dernière modification par DarkIchigo le mer. 10/août/2011 7:08, modifié 1 fois.
Avatar de l’utilisateur
graph100
Messages : 1318
Inscription : sam. 21/mai/2005 17:50

Re: Pb d'utilisation ExplorerListGadget()

Message par graph100 »

Je pense que ça doit aller là : (ligne 42 et +)

Code : Tout sélectionner

Global Left_Combo$ = "C:\"

#Flag = #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_WindowCentered|#PB_Window_Maximize
#Flag_XplorerList = #PB_Explorer_AlwaysShowSelection|#PB_Explorer_FullRowSelect|#PB_Explorer_NoDriveRequester


Global NewList History.s()
T_x_Window = 1440
T_y_Window = 820

Procedure Historing(iLocation$)
	If FileSize(iLocation$) < 0
		AddElement(History()) : History() = iLocation$
		Debug History()
	EndIf   
EndProcedure

OpenWindow(0, 0, 0, T_x_Window, T_y_Window, "Double Xplorer", #Flag)

ExplorerComboGadget(11, 5, 38, (T_x_Window/2)-9, T_y_Window-39-40, Left_Combo$, #PB_Explorer_Editable)
ExplorerListGadget(12, 6, 63, (T_x_Window/2)-9, T_y_Window-95, Left_Combo$, #Flag_XplorerList)
SetGadgetItemAttribute(12, 0, #PB_Explorer_ColumnWidth, 400, 0)
SetGadgetItemAttribute(12, 0, #PB_Explorer_ColumnWidth, 95, 1)
SetGadgetItemAttribute(12, 0, #PB_Explorer_ColumnWidth, 95, 2)
SetGadgetItemAttribute(12, 0, #PB_Explorer_ColumnWidth, 117, 3)

Quit = 0
Repeat
	Event = WaitWindowEvent()
	Select EventWindow()
		Case 0
			Select Event
				Case #PB_Event_CloseWindow : Quit = 1
					
				Case #PB_Event_Gadget
					Select EventGadget()
						Case 11
							Path_Left_Combo$ = GetGadgetText(11)
							SetGadgetText(12, Path_Left_Combo$)
							
						Case 12
								tmp$ = GetGadgetText(12)
								
								
							If tmp$ <> Path_Left_XplorerList$
								Path_Left_XplorerList$ = GetGadgetText(12)
								
								Debug Path_Left_XplorerList$
								
								SetGadgetText(11, Path_Left_XplorerList$)
								posL = GetGadgetState(12)
								File_Left_XplorerList$ = GetGadgetItemText(12, posL)
								
								If EventType() = #PB_EventType_LeftDoubleClick
									If FileSize(Path_Left_XplorerList$+File_Left_XplorerList$) < 0
										Historing(Path_Left_XplorerList$+File_Left_XplorerList$)
									Else
										RunProgram(Path_Left_XplorerList$+File_Left_XplorerList$)
									EndIf
								EndIf
							EndIf
							
					EndSelect
			EndSelect
			
	EndSelect
Until Quit = 1
_________________________________________________
Mon site : CeriseCode (Attention Chantier perpétuel ;))
DarkIchigo
Messages : 62
Inscription : lun. 22/mars/2010 11:34

Re: Pb d'utilisation ExplorerListGadget()

Message par DarkIchigo »

Impeccable merci, comme ça c'est tout bon.
Répondre