| 1530 |
dpurdie |
1 |
/////////////////////////////////////////////////////////////////////////////
|
|
|
2 |
//
|
|
|
3 |
// File Name: AskFilePath.rul
|
|
|
4 |
//
|
|
|
5 |
// Description: InstallShield script
|
|
|
6 |
//
|
|
|
7 |
// Comments: This contains the script to drive the AskFilePath Dialog.
|
|
|
8 |
// The dialog is defined in the AskFilePath.isd file and must
|
|
|
9 |
// be imported into the project for use.
|
|
|
10 |
// It uses the FileBrowseDlg.rul file to display the standard
|
|
|
11 |
// windows file open dialog when browse is selected.
|
|
|
12 |
//
|
|
|
13 |
// The AskFilePath is an exact copy of the standard IS askPath
|
|
|
14 |
// dialog and functions like a std dialog. The AskFilePath
|
|
|
15 |
// function simply accepts a title & message to change the
|
|
|
16 |
// standard ones on the dialog and a FileName field that is used
|
|
|
17 |
// initially to set the default value and returns the path selected.
|
|
|
18 |
// Return values are standard BACK, NEXT values.
|
|
|
19 |
//
|
|
|
20 |
// Usage: On the dialogs section right click on the All Dialogs Folder
|
|
|
21 |
// and select import dialog from the pop up menu. Navigate to the
|
|
|
22 |
// installshield source dir for the package being built and select
|
|
|
23 |
// the AskFilePath.isd file. The dialog can then be included in
|
|
|
24 |
// your install script as per normal.
|
|
|
25 |
//
|
|
|
26 |
/////////////////////////////////////////////////////////////////////////////
|
|
|
27 |
#include "FileBrowseDlg.rul"
|
|
|
28 |
|
|
|
29 |
#define ASKFILEPATH_NEXT 1
|
|
|
30 |
#define ASKFILEPATH_EDIT 4
|
|
|
31 |
#define ASKFILEPATH_CANCEL 9
|
|
|
32 |
#define ASKFILEPATH_BACK 12
|
|
|
33 |
#define ASKFILEPATH_BROWSE 31
|
|
|
34 |
#define ASKFILEPATH_TITLE 51
|
|
|
35 |
#define ASKFILEPATH_MSG 901
|
|
|
36 |
|
|
|
37 |
prototype NUMBER AskFilePath( STRING, STRING, BYREF STRING );
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
function NUMBER AskFilePath( Title, Msg, FileName)
|
|
|
41 |
BOOL bDone;
|
|
|
42 |
NUMBER nReturn, nControl, nResult;
|
|
|
43 |
LIST dummyList;
|
|
|
44 |
STRING tmpFileName, tmpDir;
|
|
|
45 |
begin
|
|
|
46 |
|
|
|
47 |
EzDefineDialog("AskFilePath", ISUSER, "AskFilePath", 0);
|
|
|
48 |
|
|
|
49 |
dummyList = ListCreate( STRINGLIST );
|
|
|
50 |
|
|
|
51 |
bDone = FALSE;
|
|
|
52 |
|
|
|
53 |
while (!bDone)
|
|
|
54 |
|
|
|
55 |
nControl = WaitOnDialog("AskFilePath");
|
|
|
56 |
|
|
|
57 |
switch (nControl)
|
|
|
58 |
case DLG_INIT:
|
|
|
59 |
// Initialise dialog defaults
|
|
|
60 |
if ( Title != "" ) then
|
|
|
61 |
CtrlSetText("AskFilePath", ASKFILEPATH_TITLE, Title);
|
|
|
62 |
endif;
|
|
|
63 |
if ( Msg != "" ) then
|
|
|
64 |
CtrlSetText("AskFilePath", ASKFILEPATH_MSG, Msg);
|
|
|
65 |
endif;
|
|
|
66 |
CtrlSetText("AskFilePath", ASKFILEPATH_EDIT, FileName);
|
|
|
67 |
|
|
|
68 |
case ASKFILEPATH_BACK:
|
|
|
69 |
// user clicked Back
|
|
|
70 |
nReturn = ASKFILEPATH_BACK;
|
|
|
71 |
bDone = TRUE;
|
|
|
72 |
|
|
|
73 |
case ASKFILEPATH_NEXT:
|
|
|
74 |
// user clicked Next
|
|
|
75 |
nReturn = ASKFILEPATH_NEXT;
|
|
|
76 |
bDone = TRUE;
|
|
|
77 |
|
|
|
78 |
case ASKFILEPATH_CANCEL:
|
|
|
79 |
// user clicked Cancel; ask user to verify cancellation
|
|
|
80 |
Do(EXIT);
|
|
|
81 |
|
|
|
82 |
case ASKFILEPATH_BROWSE:
|
|
|
83 |
CtrlGetText("AskFilePath", ASKFILEPATH_EDIT, tmpFileName);
|
|
|
84 |
ParsePath(tmpDir, tmpFileName, PATH);
|
|
|
85 |
nResult = FileBrowseDlg(tmpFileName,
|
|
|
86 |
"All Files (*.*)|*.*||",
|
|
|
87 |
"Select the required file",
|
|
|
88 |
tmpDir,
|
|
|
89 |
FALSE,
|
|
|
90 |
dummyList,
|
|
|
91 |
FALSE);
|
|
|
92 |
if ( nResult == 0 ) then
|
|
|
93 |
CtrlSetText("AskFilePath", ASKFILEPATH_EDIT, tmpFileName);
|
|
|
94 |
endif;
|
|
|
95 |
|
|
|
96 |
endswitch;
|
|
|
97 |
|
|
|
98 |
endwhile;
|
|
|
99 |
|
|
|
100 |
CtrlGetText("AskFilePath", ASKFILEPATH_EDIT, FileName);
|
|
|
101 |
|
|
|
102 |
EndDialog("AskFilePath");
|
|
|
103 |
ReleaseDialog("AskFilePath");
|
|
|
104 |
|
|
|
105 |
ListDestroy(dummyList);
|
|
|
106 |
|
|
|
107 |
return nReturn;
|
|
|
108 |
end;
|
|
|
109 |
|