Module CSV_Export.dg
1//==============================================================================
2// Project : SigCj - VDF Classes for Codejock
3// File : CSV_Export.pkg
4// Description : VDF Class for Codejock report control
5//
6// Revision : $Rev: 599 $
7// $Date: 2009-10-14 05:39:01 -0400 (Wed, 14 Oct 2009) $
8// $Author: pak $ Martin Pincott
9//
10// Requirements : Visual DataFlex 12.1+
11// Codejock SuitePro - Version 12.0.0+
12//
13// Copyright : (c) 2008 VDF SIG UK
14// Visual DataFlex Special Interest Group UK.
15// http://www.vdfsig.co.uk/
16// dev@vdfsig.co.uk
17//
18// This file is part of SigCj.
19//
20// SigCj is free software: you can redistribute it and/or modify
21// it under the terms of the GNU Lesser General Public License
22// as published by the Free Software Foundation, either version
23// 2.1 of the License, or (at your option) any later version.
24//
25// SigCj is distributed in the hope that it will be useful, but
26// WITHOUT ANY WARRANTY; without even the implied warranty of
27// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28// GNU Lesser General Public License for more details.
29//
30// If you have the complete SigCj workspace then a copy of the
31// GNU Lesser General Public License is in the Docs folder. If
32// not, see <http://www.gnu.org/licenses/>.
33//
34//==============================================================================
35
36Use DfAllEnt.pkg
37Use File_dlg.pkg
38
39Cd_Popup_Object oCSV_Export_Dialog is a ModalPanel
40
41 Property Handle phoInvoking_Object
42 Set Destroy_Object_State To True
43
44 Set Label to "CSV Export Details"
45 Set Location to 46 107
46 Set Size to 70 251
47 Set piMinSize to 70 251
48 Set piMaxSize to 70 251
49
50 Procedure File_Create String sFileName
51 Integer iChannel
52
53 Move (Seq_New_Channel()) to iChannel
54
55 Direct_Output channel iChannel sFileName
56 Close_Output channel iChannel sFileName
57
58 Send Seq_Release_Channel iChannel
59 End_Procedure
60
61 Object oSaveAsDialog1 is a SaveAsDialog
62 Set Initial_Folder to ((PathAtIndex(phoWorkSpace(ghoApplication), psHome(phoWorkSpace(ghoApplication)),1))+"")
63 Set Filter_String To 'Csv (*.csv)|*.csv|All (*.*)|*.*'
64 End_Object // oSaveAsDialog1
65
66 Object oSaveFile_fm is a Form
67 Set Label to "File Name:"
68 Set Size to 13 180
69 Set Location to 13 47
70 Set Prompt_Button_Mode to pb_PromptOn
71 Set Label_Col_Offset to 2
72 Set Label_Justification_Mode to JMode_Right
73
74 Procedure Prompt
75 Integer bSave bFileExists
76 String sFileTitle sFileName
77 Get Show_Dialog Of oSaveAsDialog1 To bSave
78 If bSave Begin
79 Get File_Name of (oSaveAsDialog1(self)) To sFileName
80 Set Value To sFileName
81
82 File_Exist sFileName bFileExists
83 If (not(bFileExists)) Send File_Create sFileName
84 End
85 Else Send Info_Box "You choose NOT to save"
86
87 End_Procedure // Prompt
88
89 End_Object // oSaveFile_fm
90
91 Object oOK_bn is a Button
92 Set Size to 14 14
93 Set Location to 35 209
94 Set Bitmap to "btn-ok_16.bmp"
95
96 Procedure OnClick
97 Boolean bFileExists
98 String sFileName
99
100 Get Value of oSaveFile_fm to sFileName
101 File_Exist sFileName bFileExists
102 If (bFileExists) Begin
103 Set psExport_File of (phoInvoking_Object(Self)) to (Trim(sFileName))
104 Send Close_Panel
105 End
106 Else Send Info_Box "Failed to find file"
107 End_Procedure
108
109 End_Object
110
111 Object oCancel_bn is a Button
112 Set Size to 14 14
113 Set Location to 35 227
114 Set Bitmap to "btn-cancel_16.bmp"
115
116 Procedure OnClick
117 Send Close_Panel
118 End_Procedure
119 End_Object
120
121 Procedure Activating Returns Integer
122 Integer iRetval
123 Forward Get Msg_Activating to iRetval
124
125 Set phoInvoking_Object to (Focus(Desktop))
126
127 Procedure_Return iRetval
128 End_Procedure
129Cd_End_Object
130
131//==============================================================================
132//End of Package - CSV_Export.pkg
133//==============================================================================
134