Welcome
ExplorerTree
1.0.0.2
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.
Freeware
RizlaUK
www.luadevils.com
rizlauk@luadevils.com
ExplorerTree.Create
ExplorerTree.SetCallback
ExplorerTree.GetSelectedPath
ExplorerTree.SetSelectedPath
ExplorerTree.GetSelectedType
ExplorerTree.SetPattern
ExplorerTree.GetSelectedFile
(boolean) ExplorerTree.Create ( | (string) Object, (string) Path = "", (string) Pattern = "*.*", (table) Flags = nil ) |
Creates a ExplorerTree object.
(string) The name of the AMS host object.
(string) The initial displayed directory/file.
(string) Include one or multiple patterns, like "*.lua;*.txt".
Note: Including no pattern defaults to '*.*'.
(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. |
(boolean) True if the object was created, false if not.
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 ( | (string) Object, (string) Function ) |
Sets the objects callback function.
(string) The name of the host object.
(string) The name of the callback function.
This action dose not return any value.
--[[
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");
(string) ExplorerTree.GetSelectedPath ( | (string) Object ) |
Gets the path to the currently selected folder.
(string) The name of the host object.
(string) The full path to the current active folder, or a blank string ("") is no selection.
local sPath = ExplorerTree.GetSelectedPath("Tree1");
if sPath ~= "" then
Dialog.Message("", "Selected Path: "..sPath)
end
ExplorerTree.SetSelectedPath ( | (string) Object, (string) Path ) |
Sets the path to the currently selected folder.
Note: This must be the full path to the folder, not a local path!
(string) The name of the host object.
(string) The path to the file/folder to select.
This action dose not return any value.
ExplorerTree.SetSelectedPath("Tree1", _SourceFolder.."\\AutoPlay\\Docs\\");
(string) ExplorerTree.GetSelectedType ( | (string) Object ) |
Gets the type of the currently selected item.
(string) The name of the host object.
(string) The type of the selected item ('File' or 'Folder') or a blank string if no selection.
local sType = ExplorerTree.GetSelectedType("Tree1");
if sType ~= "" then
Dialog.Message("", "Selected Type: "..sType)
end
ExplorerTree.SetPattern ( | (string) Object, (string) Pattern ) |
Sets the current file pattern.
(string) The name of the host object.
(string) The file pattern ("*.lua;*.txt").
Note: Can include one or multiple patterns, like "*.lua;*.txt".
This action dose not return any value.
ExplorerTree.SetPattern("Tree1", "*.lua;*.txt");
(string) ExplorerTree.GetSelectedFile ( | (string) Object ) |
Gets the name of the currently selected file.
(string) The name of the host object.
(string) The name of the selected file, or a blank string ("") is no selection.
local sFile = ExplorerTree.GetSelectedFile("Tree1");
if sFile ~= "" then
Dialog.Message("", "Selected File: "..sFile)
end
This File Was Generated With AMS ActionFile Editor