Project

General

Profile

Statistics
| Revision:

vdfsplat / AppSrc / cvFileDialogs.pkg @ 56

History | View | Annotate | Download (2.98 KB)

1 9 wil
//***************************************************************************
2
//*
3
//* Class:        cvSaveAsDialog
4
//* Package Name: cvFileDialogs.pkg
5
//*
6
//***************************************************************************
7
8
Use File_dlg.pkg
9
10
// *WvA: 13-01-1999 Created
11
// The Class cSelectFile_Dialog is created to support the function Select_File
12
// This function opens the Windows standard file open dialog and returns the selected
13
// file_name.
14
Class cvSelectFile_Dialog Is An OpenDialog
15
16
  Procedure Construct_Object Integer iImage_Id
17
    Forward Send Construct_Object iImage_Id
18
    Set HideReadOnly_State To True
19
  End_Procedure // Construct_Object
20
21
  Function SelectedFileName Returns String
22
    String sFileName
23
    Move "" To sFileName
24
    If (Show_Dialog(Self)) Begin
25
      Move (RTrim(File_Name(Self))) To sFileName
26
    End
27
    Function_Return sFileName
28
  End_Function // SelectedFileName
29
End_Class // cvSelectFile_Dialog
30
31
32
// *WvA: 13-01-1999 Created
33
// This function opens the Windows standard file open dialog and returns the selected
34
// file_name. Returns '' if the user didn't make a selection.
35
// **WvA: 17-10-2003 Cleaned up and added code to destroy the dynamically created
36
//                   file-open dialog
37
Function vSelect_File Global String sSupportedFileTypes String sCaptionText ;
38
                                  String sInitialFolder Returns String
39
  String sSelectedFile
40
  Integer hoOpenFileDialog
41
42
  Object oOpenFileDialog Is A cvSelectFile_Dialog
43
44
    Set Dialog_Caption    To sCaptionText
45
    Set Filter_String     To sSupportedFileTypes
46
    Set Initial_Folder    To sInitialFolder
47
48
    Move Self       To hoOpenFileDialog
49
  End_Object // oOpenFileDialog
50
51
  Get SelectedFileName Of hoOpenFileDialog To sSelectedFile
52
  Send Destroy_Object To hoOpenFileDialog
53
  Function_Return sSelectedFile
54
End_Function // vSelect_File
55
56
57
Class cvSaveAsDialog is a SaveAsDialog
58
59
  Procedure Construct_Object
60
    Forward Send Construct_Object
61
    Set HideReadOnly_State To True
62
  End_Procedure // Construct_Object
63
64
  Function SelectedFileName Returns String
65
    String sFileName
66
    Move "" To sFileName
67
    If (Show_Dialog(Self)) Begin
68
      Move (RTrim(File_Name(Self))) To sFileName
69
    End
70
    Function_Return sFileName
71
  End_Function // SelectedFileName
72
73
End_Class // cvSaveAsDialog
74
75
76
Function vSelectSaveFile Global String sSupportedFileTypes String sCaptionText String sInitialFolder Returns String
77
  String sSelectedFile
78
  Integer hoDialog
79
80
  Move "" To sSelectedFile
81
  Get Create U_cvSaveAsDialog To hoDialog
82
  If (hoDialog) Begin
83
    //Set NoChangeDir_State Of hoDialog To True
84
    Set Dialog_Caption    Of hoDialog To sCaptionText
85
    Set Filter_String     Of hoDialog To sSupportedFileTypes
86
    Set Initial_Folder    Of hoDialog To sInitialFolder
87
    Get SelectedFileName  Of hoDialog To sSelectedFile
88
    Send Destroy Of hoDialog
89
  End
90
  Function_Return sSelectedFile
91
End_Function // vSelectSaveFile