forked from ChrisS85/CGUI
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCFolderDialog.ahk
50 lines (43 loc) · 1.43 KB
/
CFolderDialog.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Class: CFolderDialog
This class is used for open/save file dialogs.
*/
Class CFolderDialog
{
;Property: ShowNewFolderButton
;If true, a button to create a new folder will be shown.
;Property: ShowEditField
;If true, an edit field to enter a folder name will be shown.
;Property: NewDialogStyle
;Makes sure that this will work in a Preinstallation Environment like WinPE or BartPE. However, this prevents the appearance of a "make new folder" button, at least on Windows XP.
;Property: Folder
;Initial directory of the dialog and the selected directory when the user confirmed the selection.
;Property: Title
;Title of the dialog window.
/*
Constructor: __New
Creates the instance but does not show the dialog. It can be used to store a configuration of the dialog that can be reused.
Returns:
An instance of the <CFolderDialog> class.
*/
__New()
{
this.ShowNewFolderButton := 0
this.ShowEditField := 0
this.NewDialogStyle := 0
this.InitialDirectory := ""
this.Title := ""
}
/*
Function: Show
Shows a folder dialog window. To show a modal window, set OwnDialogs := 1 for the GUI thread that calls this.
Returns:
1 if the user confirmed the selection and pressed OK, 0 if the folder selection was cancelled.
*/
Show()
{
FileSelectFolder, result, ((this.ShowNewFolderButton > 0) + (this.ShowEditField>0) * 2 + (this.NewDialogStyle > 0) * 4, % this.Folder, % this.Title
this.Folder := result
return result != ""
}
}