Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Open browse for folder dialog.

 

Syntax

 

sFile = Dialog_BrowseForFolder(hwnd, Title, DefaultDirectory, ShowFiles)

 

Returns

 

String.

 

Parameters

 

Name

Type

Optional

Meaning

hwnd

Number

No

Handle of the dialog containing the control

Title

String

No

Dialog caption

DefaultDirectory

String

No

Default starting dialog directory

ShowFiles

String

No

%TRUE or %FALSE in order to show or hide files

 

Remarks

 

Restrictions

 

See also

 

Examples

 

Sample script

 

USES "UI"

 

DIM sFile   AS STRING

 

sFile = Dialog_BrowseForFolder(0, "Please select a directory", "C:\thinbasic", %FALSE)

 

MSGBOX 0, sFile

 

Thanks to Abraxas for the following script example

USES "UI"

USES "FILE"

 

Dim SelectedDIR    As String ' The directory that we want to scan

Dim TheFileList()  As String ' The Filename Table

Dim FileLength()   As DWORD  ' The File Length Table

Dim NumberofFiles  As DWORD  ' The Number of files in the list

Dim n              As Long   ' Loop Variable

Dim sMsg           As String ' Message String

 

SelectedDIR = DIALOG_BrowseForFolder(0, "Please select a directory""C:\", %False)

If SelectedDIR <> "" Then

 

  NumberofFiles = DIR_ListArray(TheFileList, SelectedDIR, "*.*"%FILE_NORMAL Or %FILE_ADDPATH)

 

  ' Fill File Length Table

  ReDim FileLength(NumberofFiles) ' Allocate space for File Length Table

  For n = 1 To NumberofFiles

    FileLength(n) = File_SIZE (TheFileList(n)) 

  Next

 

  sMsg  = "Number of files found: " & NumberofFiles & $CRLF & $CRLF

  sMsg += "First 10 files are:" & $CRLF & $CRLF

  sMsg += JOIN$(TheFileList, $CRLF"", 1, 10) ' add only 10 files to list

 

Else

  sMsg += "No selected folder. Operation not performed."

End If

 

MSGBOX 0, sMsg

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software