Página 1 de 1
Folder Explorer TreeView ....
Publicado: Mar May 30, 2017 1:59 pm
por ChrisGillard
Hi, I am wanting to use a Folder Explorer TreeView to embed in a form .... very similar to the one in Xailer Dbf Explorer.
I am trying to not use a Folder Dialog or an ActiveX.
I have looked at the xailer\samples but cannot see anything similar to use as a start.
Does anyone have a piece of code that might save me doing it totally myself?
Any help would be appreciated.
Chris

- Folder TreeView.png (25.02 KiB) Visto 4470 veces
Re: Folder Explorer TreeView ....
Publicado: Mié May 31, 2017 4:49 pm
por ignacio
ChrisGillard escribió:Hi, I am wanting to use a Folder Explorer TreeView to embed in a form .... very similar to the one in Xailer Dbf Explorer.
I am trying to not use a Folder Dialog or an ActiveX.
I have looked at the xailer\samples but cannot see anything similar to use as a start.
Does anyone have a piece of code that might save me doing it totally myself?
Any help would be appreciated.
From the DBF editor:
Código: Seleccionar todo
METHOD LoadFiles( cDir ) CLASS TFrmMain
LOCAL oItem
LOCAL cExt
IF ::oComboBox1:cText == "ADSADT"
cExt := "ADT"
ELSE
cExt := "DBF"
ENDIF
UPDATE ::cDir TO cDir
Application:lbusy := .t.
::oTree:DeleteItems()
IF !Empty( ::cDir )
oItem := ::oTree:AddItem( ::cDir, 1, 1, .t. )
AddTables( oItem, ::cDir, cExt, ::cPerExt )
ENDIF
IF ::oTree:GetCount() > 0
::oTree:ExpandAll()
::oTree:SelectRoot()
ENDIF
IF ::oDataSource == NIL
::SelectRDD()
ENDIF
Application:lbusy := .f.
RETURN NIL
STATIC FUNCTION AddTables( oParent, cDir, cExt, cPerExt )
LOCAL oItem
LOCAL aDir, aFile
LOCAL cFile
// First we load files
aDir := Directory( cDir + "\*." + cExt )
Asort( aDir,,,{|x,y| Upper( x[ 1 ] ) < Upper( y[ 1 ] ) } )
FOR EACH aFile IN aDir
cFile := aFile[ F_NAME ]
WITH OBJECT oParent:AddItem( cFile, 2, 2 )
:Cargo := cDir + "\" + cFile
END WITH
NEXT
IF !Empty( cPerExt )
aDir := Directory( cDir + "\*." + cPerExt )
Asort( aDir,,,{|x,y| Upper( x[ 1 ] ) < Upper( y[ 1 ] ) } )
FOR EACH aFile IN aDir
cFile := aFile[ F_NAME ]
WITH OBJECT oParent:AddItem( cFile, 2, 2 )
:Cargo := cDir + "\" + cFile
END WITH
NEXT
ENDIF
// Then we load directories
aDir := Directory( cDir + "\*.*", "D" )
Asort( aDir,,,{|x,y| Upper( x[ 1 ] ) < Upper( y[ 1 ] ) } )
FOR EACH aFile IN aDir
cFile := aFile[ F_NAME ]
IF "D" $ aFile[ F_ATTR ] .AND. cFile != "." .AND. cFile != ".."
WITH OBJECT oParent:AddItem( cFile, 3, 3 )
AddTables( :__WithObject(), cDir + "\" + cFile, cExt )
END WITH
ENDIF
NEXT
RETURN NIL
Re: Folder Explorer TreeView ....
Publicado: Jue Jun 01, 2017 6:05 pm
por ChrisGillard
Hi Ignacio,
Thank you very much for the code ... it is already looking very nice with some famfamfam icons.

- 01-06-2017 16-59-24.png (9.99 KiB) Visto 4415 veces
Much appreciated.
Chris