SG_ExplorerListGadget

Syntax:

Result = SG_ExplorerListGadget(#SG_GadgetID_L.l, X_Pos_L.l, Y_Pos_L.l, Width_L.l, Height_L.l, Directory_S.s, [Flags_L])

Parameters:

SG_GadgetID_L

=

The number of the gadget

X_Pos_L

=

the x-position of the gadget

Y_Pos_L

=

the y position of the gadget

Width_L

=

the width of the gadget

Height_L

=

the height of the gadget

Directory_S

=

the starting directory

[Flags_L]

=

'Flags' are always optional and can be composed of one or several (using the bitwise OR operator '|')


Return Values:

Result

=

contains a pointer to the internal gadget structur. See the source of this lib for more information


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_S 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_S of "" will display the root and set '*.*' as pattern.

'Flags' can be a combination of the following values:

#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.

The following functions can be used to control the gadget:

- SG_AddGadgetColumn(): Add a new automatically or custom filled column to the gadget. See the SG_AddGadgetColumn() function help for more details.

- SG_RemoveGadgetColumn(): Remove a column from the gadget.

- SG_GetGadgetText(): Get the currently displayed directory.

- SG_SetGadgetText(): Changes the currently displayed directory, or the current pattern for files.

- SG_GetGadgetState(): Get the first selected item (-1 if none selected).

- SG_GetGadgetItemFont(): returns the fontNr of the specified item.

- SG_GetGadgetItemText(): Get the name of an item (or column header, if item = -1).

- SG_SetGadgetItemText(): Alter the contents of any items text (or column header, if item = -1), or fill a custom column with data.

- SG_GetGadgetItemState(): Check if an item is a directory or a file, and if it is currently selected.

- SG_SetGadgetItemColor(): change the color of an item

- SG_ShowListItem(): Shows the specified item.

- SG_CountGadgetItems(): Count the items in the current directory.

- SG_GetGadgetItemAttribute() / SG_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 SG_SetGadgetColor() and SG_GetGadgetColor() functions 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.


Example:


Remarks:

The maximum number of colums for these gadget is 16. For the purpose of changing the header width with the mouse, there is a special way to change the mouse, if it is over the gap between two header columns. In this case, the function `SG_MoveLiconHeader()` returns 1, otherwise 0



Supported OS:   Windows