#include "FiveWin.ch"
static oImageList
//----------------------------------------------------------------------------//
Function Main()
local oDlg, oGet, cText := ""
DEFINE DIALOG oDlg SIZE 1000, 600
oDlg:lHelpIcon := .F.
//@ 0, 100 GET oGet VAR cText MEMO SIZE 350, 300 PIXEL OF oDlg
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( SourceEdit( , "", , 0, 200, 599, 799, ;
, , , , oDlg, , , , , , , , .T., .F., , , ), ;
oGet := SourceEditor(), oGet:SetText( "" ), ;
BuildTree( oDlg, oGet ) )
oImageList:End()
return nil
//----------------------------------------------------------------------------//
Function BuildTree( oDlg, oGet )
local oTreeView := TTreeView():New( 0, 0, oDlg )
local cPath := "c:\harbour\*", oItem
oImageList := TImageList():New()
oDlg:SetText( cPath )
oTreeView:SetSize( 200, oDlg:nHeight - 32 )
oTreeView:bChanged = { || If( ( oItem := oTreeView:GetSelected() ) != nil,;
if( oGet:ClassName() == "TGET", ;
oGet:SetText( MemoRead( oItem:Cargo ) ), ;
( oGet:SetText( oGet:OpenFile( oItem:Cargo, .T. ) ), oGet:GoHome() ) ), ) }
oImageList:Add( TBitmap():Define( "folder",, oDlg ),;
TBitmap():Define( "fldmask",, oDlg ) )
oImageList:Add( TBitmap():Define( "prg",, oDlg ),;
TBitmap():Define( "prgMask",, oDlg ) )
oTreeView:SetImageList( oImageList )
ReadFiles( cPath, oTreeView )
return nil
//----------------------------------------------------------------------------//
Function ReadFiles( cPath, oTreeView )
local aFiles := Directory( cPath, "D" )
local oTreeItem, n
for n = 1 to Len( aFiles )
if aFiles[ n ][ 1 ] != "." .and. aFiles[ n ][ 1 ] != ".."
oTreeItem = oTreeView:Add( aFiles[ n ][ 1 ], If( aFiles[ n ][ 5 ] == "D", 0, 1 ) )
if aFiles[ n ][ 5 ] == "D"
ReadFiles( SubStr( cPath, 1, RAt( "\", cPath ) ) + aFiles[ n ][ 1 ] + "\*", oTreeItem )
else
oTreeItem:Cargo = SubStr( cPath, 1, RAt( "\", cPath ) ) + aFiles[ n ][ 1 ]
endif
endif
next
return nil
//----------------------------------------------------------------------------//