wpe33.gif (963 bytes) jsFileTree

Use this explorer-like directory component anywhere you want the user to be able to browse the network (or desktop) drives.

wpe4C.gif (5258 bytes)

type TjsCustomFileTree = class(TCustomTreeView)
private
    FIgnoreCallTo_ExpandDir : Boolean;
    FDirectory : String;
    FImageList : TImageList;
    FjsFile : TjsFile;
    FVisibleMenus : TVisibleMenus;
    FCopyDirName : String;
    FDeleteDirAfterPaste : Boolean;
    FSourceNode : TTreeNode;
    FDragDropTargetNode : TTreeNode;
    FAllowDragDrop : Boolean;
    function GetAllowDragDrop : Boolean;
    procedure SetAllowDragDrop(bAllowDragDrop : Boolean);
    function GetDirectory : String;
    procedure SetDirectory(sDir : String);
    function FormatDirName(sDirName : String) : String;
    function GetVisibleMenus : TVisibleMenus;
    procedure SetVisibleMenus(visibleMenus : TVisibleMenus);
    function ExtractDirNameFromDirPath(sDirPath : String) : String;
    function ExtractFirstPartOfPath(sDirPath : String; var sRestOfPath : String) : String;
protected
    procedure ExpandDir(Sender: TObject; Node: TTreeNode; var AllowExpansion: Boolean); virtual;
    procedure InitDiskDrives; virtual;
    procedure SetParentComponent(Value: TComponent); override;
    procedure Expand(Node: TTreeNode); override;
    procedure Change(Node: TTreeNode); override;
    procedure DragDrop(Source: TObject; X, Y: Integer); override;
    procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); override;
    function IsValidDir(sDirName : String) : Boolean; virtual;
    procedure CreatePopUpMenus; virtual;
    procedure InitPopupMenus(Sender : TObject); virtual;
    procedure Loaded; override;
    procedure Edit(const Item: TTVItem); override;
    procedure MakeDir(Sender : TObject); virtual;
    procedure StoreCutDirName(Sender : TObject); virtual;
    procedure StoreCopyDirName(Sender : TObject); virtual;
    procedure PasteDir(Sender : TObject); virtual;
    procedure DeleteDir(Sender : TObject); virtual;
    procedure RenameDir(Sender : TObject); virtual;
public
    property Items;
    property PopupMenu;
    property Images;
    property StateImages;
    property Directory : String read GetDirectory write SetDirectory;
    function GetFullDirPath(Node : TTreeNode) : String; virtual;
    function GotoDirNode(sDirPath : String) : TTreeNode;
    constructor Create(AOwner : TComponent); override;
    destructor Destroy; override;
published
    property VisibleMenus : TVisibleMenus read GetVisibleMenus write SetVisibleMenus;
    property AllowDragDrop : Boolean read GetAllowDragDrop write SetAllowDragDrop;
end;

TjsFileTree = class(TjsCustomFileTree)
published
    property ShowButtons;
    property BorderStyle;
    property ShowLines;
    property ShowRoot;
    property HideSelection;
    property Indent;
    property OnEditing;
    property OnEdited;
    property OnExpanding;
    property OnExpanded;
    property OnCollapsing;
    property OnCollapsed;
    property OnChanging;
    property OnChange;
    property OnDeletion;
    property Align;
    property Enabled;
    property Font;
    property Color;
    property ParentColor default False;
    property ParentCtl3D;
    property Ctl3D;
    property TabOrder;
    property TabStop default True;
    property Visible;
    property OnClick;
    property OnEnter;
    property OnExit;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
    property OnDblClick;
    property OnKeyPress;
    property ParentFont;
    property ParentShowHint;
    property ShowHint;
end;