ExplorerTree Help File

ExplorerTree Help File

Plugin Name:

ExplorerTree

Current Version:

1.0.0.2

Description:

Creates a tree listing of the directory tree just as Explorer does. It lets the user navigate through his file system, and choose a file or folder.

Licence:

Freeware

Author:

RizlaUK

Web:

www.luadevils.com

E-mail:

rizlauk@luadevils.com


Table of Contents

ExplorerTree.Create
ExplorerTree.SetCallback
ExplorerTree.GetSelectedPath
ExplorerTree.SetSelectedPath
ExplorerTree.GetSelectedType
ExplorerTree.SetPattern
ExplorerTree.GetSelectedFile

ExplorerTree.Create


(boolean) ExplorerTree.Create ( 

(string) Object,

(string) Path = "",

(string) Pattern = "*.*",

(table) Flags = nil )

Description

Creates a ExplorerTree object.

Parameters

Object

(string) The name of the AMS host object.

Path

(string) The initial displayed directory/file.

Pattern

(string) Include one or multiple patterns, like "*.lua;*.txt".

Note: Including no pattern defaults to '*.*'.

Flags

(table) Flags can be a combination of the following values:

CONSTANT

VALUE

DESCRIPTION

BorderLess

Boolean

Create object without borders.

AlwaysShowSelection

Boolean

The selection is still visible, even when the object is not activated.

NoLines

Boolean

Hide the little lines between each node.

NoButtons

Boolean

Hide the '+' node buttons.

NoFiles

Boolean

No files will be displayed.

NoDriveRequester

Boolean

There will be no 'please insert disk into drive X' displayed.

NoMyDocuments

Boolean

The 'My Documents' Folder will Not be displayed.

AutoSort

Boolean

The content will be sorted automatically by name.

Returns

(boolean) True if the object was created, false if not.


Example

tTreeFlags={}
tTreeFlags.BorderLess = false -- Create object without borders.
tTreeFlags.AlwaysShowSelection = true -- The selection is still visible, even when the object is not activated.
tTreeFlags.NoLines = false -- Hide the little lines between each node.
tTreeFlags.NoButtons = false -- Hide the '+' node buttons.
tTreeFlags.NoFiles = false -- No files will be displayed.
tTreeFlags.NoDriveRequester = false -- There will be no 'please insert disk into drive X' displayed.
tTreeFlags.NoMyDocuments = false -- The 'My Documents' Folder will Not be displayed.
tTreeFlags.AutoSort = false -- The content will be sorted automatically by name.


local bCreate = ExplorerTree.Create("Tree1", "", "*.ini;*.txt", tTreeFlags);
if bCreate then
    -- object was created
    
else
    -- object was not created
    
end



ExplorerTree.SetCallback


ExplorerTree.SetCallback ( 

(string) Object,

(string) Function )

Description

Sets the objects callback function.

Parameters

Object

(string) The name of the host object.

Function

(string) The name of the callback function.

Returns

This action dose not return any value.


Example

--[[

The callback function exposes the following events:

OnSetFocus : sArgument = ""

OnKillFocus : sArgument = ""

OnRightClick : sArgument = ""

OnDoubleClick : sArgument = ""

OnSelect : sArgument = Selected path to file/folder or ""

OnKey : sArgument = KeyCode (use tonumber())

OnReturn : sArgument = Selected path to file/folder or ""

]]

function MyCallback(sObject, sEvent, sArgument)
    
    Debug.Print("Object="..sObject.." - Event="..sEvent.." - sArgument="..sArgument.."\r\n")

end

ExplorerTree.SetCallback ("Tree1", "MyCallback");



ExplorerTree.GetSelectedPath


(string) ExplorerTree.GetSelectedPath ( 

(string) Object )

Description

Gets the path to the currently selected folder.

Parameters

Object

(string) The name of the host object.

Returns

(string) The full path to the current active folder, or a blank string ("") is no selection.


Example

local sPath = ExplorerTree.GetSelectedPath("Tree1");
if sPath ~= "" then
    Dialog.Message("", "Selected Path: "..sPath)
end



ExplorerTree.SetSelectedPath


ExplorerTree.SetSelectedPath ( 

(string) Object,

(string) Path )

Description

Sets the path to the currently selected folder.

Note: This must be the full path to the folder, not a local path!

Parameters

Object

(string) The name of the host object.

Path

(string) The path to the file/folder to select.

Returns

This action dose not return any value.


Example

ExplorerTree.SetSelectedPath("Tree1", _SourceFolder.."\\AutoPlay\\Docs\\");



ExplorerTree.GetSelectedType


(string) ExplorerTree.GetSelectedType ( 

(string) Object )

Description

Gets the type of the currently selected item.

Parameters

Object

(string) The name of the host object.

Returns

(string) The type of the selected item ('File' or 'Folder') or a blank string if no selection.


Example

local sType = ExplorerTree.GetSelectedType("Tree1");
if sType ~= "" then
    Dialog.Message("", "Selected Type: "..sType)
end



ExplorerTree.SetPattern


ExplorerTree.SetPattern ( 

(string) Object,

(string) Pattern )

Description

Sets the current file pattern.

Parameters

Object

(string) The name of the host object.

Pattern

(string) The file pattern ("*.lua;*.txt").

Note: Can include one or multiple patterns, like "*.lua;*.txt".

Returns

This action dose not return any value.


Example

ExplorerTree.SetPattern("Tree1", "*.lua;*.txt");



ExplorerTree.GetSelectedFile


(string) ExplorerTree.GetSelectedFile ( 

(string) Object )

Description

Gets the name of the currently selected file.

Parameters

Object

(string) The name of the host object.

Returns

(string) The name of the selected file, or a blank string ("") is no selection.


Example

local sFile = ExplorerTree.GetSelectedFile("Tree1");
if sFile ~= "" then
    Dialog.Message("", "Selected File: "..sFile)
end





This File Was Generated With AMS ActionFile Editor