Welcome
ExplorerList
1.0.0.2
Creates a listing of a directory just as Explorer does. It lets the user choose a file or a folder and (if you do not prevent it by a flag) navigate through the whole directory tree.
Freeware
RizlaUK
www.luadevils.com
rizlauk@luadevils.com
ExplorerList.Create
ExplorerList.GetPath
ExplorerList.SetPath
ExplorerList.GetSelectedItem
ExplorerList.GetSelectedItemType
ExplorerList.SetPattern
ExplorerList.SetDisplay
ExplorerList.SetCallback
ExplorerList.SetDropFiles
ExplorerList.GetSelectedItemTable
(boolean) ExplorerList.Create ( | (string) Object, (string) Path = "", (string) Pattern = "*.*", (table) Flags = nil ) |
Creates a ExplorerList object.
(string) The name of the host object.
Note: The host object MUST be an AMS ListBox.
(string) The initial displayed directory.
Note: The path must end with a lua backslash '\\'. Including no path will display the root containing the drives.
(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 visible, even when the object is not activated. |
MultiSelect | Boolean | Enable multiple selection of items in the object. |
GridLines | Boolean | Display separator lines between rows And columns. |
HeaderDragDrop | Boolean | In report view, the headers can be changed by Drag'n'Drop. |
FullRowSelect | Boolean | The selection covers the full row instead of the first column. |
NoFiles | Boolean | No files will be displayed. |
NoFolders | Boolean | No folders will be displayed. |
NoParentFolder | Boolean | There will be no [..] link To the parent folder. |
NoDirectoryChange | Boolean | The directory cannot be changed by the user. |
NoDriveRequester | Boolean | There will be no 'please insert disk into drive X' displayed. |
NoSort | Boolean | The user cannot sort the content by clicking on a column header. |
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, flase if any error.
-- creates a ExplorerList in the object "ListBox1"
bCreate = ExplorerList.Create("ListBox1", nil, nil, tListFlags);
if bCreate then
-- enables the user to drop files on object "ListBox1"
ExplorerList.SetDropFiles("ListBox1", true);
ExplorerList.SetCallback("ListBox1", "MyCallback");
else
-- object could not be created
-- Test for error
error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end
end
(string) ExplorerList.GetPath ( | (string) Object ) |
Gets the current displayed directory.
(string) The name of the host object.
(string) The path of the current folder/drive, or a blank string ("") if no current folder.
-- gets the current path and displays it in a dialog
local sPath = ExplorerList.GetPath("ListBox1");
if sPath ~= "" then
Dialog.Message("ExplorerList","Current Path: "..sPath)
end
ExplorerList.SetPath ( | (string) Object, (string) Path ) |
Sets the current displayed directory.
(string) The name of the host object.
(string) The path to the folder to diaplay.
Note: The path must end with a lua backslash '\\'
This action dose not return any value.
-- sets the current path to the project "Docs" folder
ExplorerList.SetPath("ListBox1", _SourceFolder.."\\AutoPlay\\Docs\\");
(string) ExplorerList.GetSelectedItem ( | (string) Object ) |
Gets the name of the currently select file or folder.
(string) The name of the host object.
(string) The name of the current selected file/folder, or a blank string ("") if no selection.
-- gets the name of the current selected item and displays it in a dialog
local sItem = ExplorerList.GetSelectedItem("ListBox1");
if sItem ~= "" then
Dialog.Message("ExplorerList","Current Item: "..sItem)
end
(string) ExplorerList.GetSelectedItemType ( | (string) Object ) |
Gets the type of the currently select file or folder.
(string) The name of the host object.
(string) The type ('File' or 'Folder') of the current selected item, or a blank string ("") if no selection.
-- gets the type of the current selected item and displays it in a dialog
local sItemType = ExplorerList.GetSelectedItemType("ListBox1");
if sItemType ~= "" then
Dialog.Message("ExplorerList","Current Item Type: "..sItemType)
end
ExplorerList.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.
-- sets the display file pattern to "*.lua;*.txt;*.html"
ExplorerList.SetPattern("ListBox1", "*.lua;*.txt;*.html");
ExplorerList.SetDisplay ( | (string) Object, (number) Mode ) |
Changes the display mode of the ExplorerList.
(string) The name of the host object.
(number) The mode to set.
Note: can include one or multiple patterns, like "*.lua;*.txt".
CONSTANT | VALUE | DESCRIPTION |
ExplorerList_LargeIcon | NA | NA |
ExplorerList_SmallIcon | NA | NA |
ExplorerList_List | NA | NA |
ExplorerList_Report | NA | NA |
This action dose not return any value.
-- sets the display mode to 'ExplorerList_Report' (default)
ExplorerList.SetDisplay("ListBox1", ExplorerList_Report);
ExplorerList.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 = ""
OnHeaderClick : sArgument = Header index (use tonumber())
OnHeaderRightClick : sArgument = Header index (use tonumber())
OnRightClick : sArgument = Selected path or ""
OnRightDoubleClick : sArgument = Selected path or ""
OnDoubleClick : sArgument = Selected path or ""
OnClick : sArgument = Selected path or ""
OnKey : sArgument = KeyCode (use tonumber())
OnReturn : sArgument = Selected path or ""
OnDropFile : sArgument = Filepath
]]
Debug.ShowWindow();
function MyCallback(sObject, sEvent, sArgument)
Debug.Print("Object="..sObject.." - Event="..sEvent.." - sArgument="..sArgument.."\r\n")
end
ExplorerList.SetCallback("ListBox1", "MyCallback");
ExplorerList.SetDropFiles ( | (string) Object, (boolean) State ) |
Enable or disable drop files.
(string) The name of the host object.
(boolean) True to enable drop files.
This action dose not return any value.
(table) ExplorerList.GetSelectedItemTable ( | (string) Object ) |
Gets a table of the selected items.
(string) The name of the host object.
(table) A table of the selected items, or nil if any error.
The table is indexed by the following values
Selected, The number if items that are selected.
Index, A table containing the item 0 based indexes.
Name, A table containing the item names.
Type, A table containing the item types ("File" or "Folder")
-- get the selected items
tSelected=ExplorerList.GetSelectedItemTable("ListBox1");
if tSelected then
local sOutput=""
-- loop the selected items and show the result in a dialog.
for nIndex=1, tSelected.Selected do
sOutput=sOutput.."Index="..tSelected.Index[nIndex].." - Name="..tSelected.Name[nIndex].." - Type="..tSelected.Type[nIndex].."\r\n"
end
Dialog.Message("",sOutput)
end
This File Was Generated With AMS ActionFile Editor