// c_path := GETCURDIR()
FUNCTION SUB_DIR()
local oDlg, oBrw, oTree, oFont, b
oTree := MakeTree()
DEFINE DIALOG oDlg SIZE 390,400 PIXEL ;
TITLE 'Select Directory' FONT oImgfont2 ;
STYLE WS_POPUP | WS_VISIBLE | WS_DLGFRAME | WS_THICKFRAME
oDlg:SetBrush( oBrush2 )
@ 10,10 XBROWSE oBrw SIZE 165, 150 PIXEL OF oDlg NOBORDER
oBrw:SetTree( oTree )
oBrw:bKeyChar := { |nKey| If( nKey == VK_RETURN .and. ! Empty( oBrw:oTreeItem:bAction ), ;
Eval( oBrw:oTreeItem:bAction, oBrw:oTreeItem ), nil ) }
WITH OBJECT oBrw:aCols[ 1 ]
:AddBmpFile( "\fwh\bitmaps\hdrive.bmp" )
:nWidth := 300
:cHeader := 'Project-Selection'
b := :bLDClickData
:bLDClickData := { |r,c,f,o| ToggleFolder( r,c,f,o,b ) }
END
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 2 ] ;
PICTURE '@EZ 999,999,999' HEADER 'Bytes'
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 3 ] HEADER 'Date'
oBrw:CreateFromCode()
@ 165, 70 BTNBMP oBtn1 FILENAME c_path + "\Bitmaps\Close.bmp" ;
SIZE 60, 30 OF oDlg PIXEL NOBORDER 2007 ;
LEFT ;
PROMPT " &EXIT" ;
FONT oTxtfont ;
ACTION oDlg:End()
oBtn1:cTooltip := "Exit Image-Viewer"
oBtn1:lTransparent := .T.
oBtn1:l2007 := .F.
oBtn1:SetColor( 0 )
ACTIVATE DIALOG oDlg CENTER
RETURN NIL
//----------------------------------------------------------------------------//
STATIC FUNCTION ToggleFolder( r, c, f, oCol, b )
local oBrw := oCol:oBrw
local oItem := oBrw:oTreeItem
If ! oItem:lOpened .and. ! Empty( oItem:bAction )
Eval( oItem:bAction, oItem )
endif
if b != nil
Eval( b, r, c, f, oCol )
endif
return nil
//----------------------------------------------------------------------------//
STATIC FUNCTION MAKETREE()
local oTree, oItem, n
TREE oTree
TREEITEM oItem PROMPT c_Path
oItem:Cargo := { c_Path + "\", 0, CtoD( '' ), Space( 8 ), 'D', c_Path + "\" }
oItem:bAction := { |o| o:SetTree( SubTree( o ) ), o:bAction := NIL }
ENDTREE
RETURN OTREE
//----------------------------------------------------------------------------//
STATIC FUNCTION SUBTREE( oParent )
local oTree, n, oItem, nLevel, nItems := 0
local cFolder := oParent:Cargo[ 6 ], cSubDir
local aDir := Directory( cFolder + '\*.', 'D' )
nLevel := oParent:nLevel + 1
TREE oTree
FOR n := 1 to Len( aDir )
IF ! ( aDir[ n ][ 1 ] = '.' )
TREEITEM oItem PROMPT aDir[ n ][ 1 ]
oItem:nlevel := nLevel
oItem:Cargo := aDir[ n ]
AAdd( oItem:Cargo, cFolder + Chr(92) + aDir[ n ][ 1 ] )
IF 'D' $ aDir[ n ][ 5 ]
cSubDir := "3"
oItem:bAction := { |o| o:SetTree( SubTree( o ) ), o:bACtion := MsgAlert( "Project" ) }
ENDIF
nItems++
ENDIF
NEXT
ENDTREE
RETURN oTree