ExplorerListGadget()
Syntax
Result = ExplorerListGadget(#Gadget, x, y, Width, Height, Directory$, [, Flags])Description
Creates a listing of a directory just as Explorer does. If #PB_Any is used as '#Gadget' parameter, the new gadget number will be returned as 'Result'. 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.
Directory$ is the initial displayed directory, it can include one or multiple patterns, like "C:\*.pb;*.pbi". If no pattern is included, the directory must end with a '\'. Including no directory will display the root containing the drives. Including no pattern defaults to '*.*'. So a Directory$ of "" will display the root and set '*.*' as pattern.
'Flags' can be a combination of the following values:#PB_Explorer_BorderLess : Create Gadget without borders. #PB_Explorer_AlwaysShowSelection : The selection is visible, even when the gadget is not activated. #PB_Explorer_MultiSelect : Enable multiple selection of items in the gadget. #PB_Explorer_GridLines : Display separator lines between rows and columns. #PB_Explorer_HeaderDragDrop : In report view, the headers can be changed by Drag'n'Drop. #PB_Explorer_FullRowSelect : The selection covers the full row instead of the first column. #PB_Explorer_NoFiles : No files will be displayed. #PB_Explorer_NoFolders : No folders will be displayed. #PB_Explorer_NoParentFolder : There will be no [..] link to the parent folder. #PB_Explorer_NoDirectoryChange : The directory cannot be changed by the user. #PB_Explorer_NoDriveRequester : There will be no 'please insert drive X:' displayed. #PB_Explorer_NoSort : The user cannot sort the content by clicking on a column header. #PB_Explorer_NoMyDocuments : The 'My Documents' Folder will not be displayed as a separate item. #PB_Explorer_AutoSort : The content will be sorted automatically by name.You can add a 'mini help' to this gadget by using GadgetToolTip().
The following functions can be used to control the gadget:
- ChangeListIconGadgetDisplay(): Change the display just like you can with ListIconGadget().
- AddGadgetColumn(): Add a new automatically or custom filled column to the gadget. See the AddGadgetColumn() command help for more details.
- RemoveGadgetColumn(): Remove a column from the gadget.
- GetGadgetText(): Get the currently displayed directory.
- SetGadgetText(): Changes the currently displayed directory, or the current pattern for files.
- GetGadgetState(): Get the first selected item (-1 if none selected).
- GetGadgetItemText(): Get the name of an item (or column header, if item = -1).
- SetGadgetItemText(): Alter the contents of any items text (or column header, if item = -1), or fill a custom column with data.
- GetGadgetItemState(): Check if an item is a directory or a file, and if it is currently selected.
- CountGadgetItems(): Count the items in the current directory.
- GetGadgetItemAttribute() / SetGadgetItemAttribute(): With the following attribute:#PB_Explorer_ColumnWidth : Returns/Changes the width of the given 'Column'. The 'Item' parameter is ignored.
This gadget supports the SetGadgetColor() and GetGadgetColor() commands with the following values as 'ColorType':#PB_Gadget_FrontColor: Textcolor #PB_Gadget_BackColor : Backgroundcolor #PB_Gadget_LineColor : Color for the gridlines if the #PB_Explorer_GridLines flag is used.ExplorerListGadget() supports the following events reported by EventType():#PB_EventType_Change : The selection or the current displayed directory has changed. #PB_EventType_LeftClick : User clicked on an item with the left mouse button. #PB_EventType_RightClick : User clicked on an item with the right mouse button. #PB_EventType_LeftDoubleClick : User doubleclicked on an item with the left mouse button. #PB_EventType_RightDoubleClick : User doubleclicked on an item with the right mouse button.Example:If OpenWindow(0, 0, 0, 400, 200, "ExplorerListGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) ExplorerListGadget(0, 10, 10, 380, 180, "*.*", #PB_Explorer_MultiSelect) Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow EndIf
Supported OS
All