Creates a tree listing of the directory tree just as Explorer does.
If #PB_Any is used as '#Gadget' parameter, the new gadget identifier will be returned as 'Result'.
It lets the user navigate through his file system, and choose a file or folder.
Directory$ is the directory that will be initially selected. 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 still visible, even when the gadget is not activated.
#PB_Explorer_NoLines : Hide the little lines between each node.
#PB_Explorer_NoButtons : Hide the '+' node buttons.
#PB_Explorer_NoFiles : No files will be displayed.
#PB_Explorer_NoDriveRequester : There will be no 'please insert drive X:' displayed.
#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:
- GetGadgetText(): Get the full path of the currently selected directory/file.
- SetGadgetText(): Set the currently selected file/directory.
- GetGadgetState(): Check if the selected item is a file or a directory.
ExplorerTreeGadget() supports the following Events reported by EventType():
#PB_EventType_Change : The selection 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,300,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"ExplorerTreeGadget") And CreateGadgetList(WindowID(0))
ExplorerTreeGadget(0, 10, 10, 280, 280, "*.pb;*.pbi")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
