forked from morbac/xmltools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectFileDlg.cpp
61 lines (49 loc) · 1.55 KB
/
SelectFileDlg.cpp
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
51
52
53
54
55
56
57
58
59
60
61
// SelectFileDlg.cpp : implementation file
//
#include "stdafx.h"
#include "XMLTools.h"
#include "SelectFileDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSelectFileDlg dialog
CSelectFileDlg::CSelectFileDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSelectFileDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSelectFileDlg)
m_sSelectedFilename = _T("");
m_sRootElementSample = _T("");
//}}AFX_DATA_INIT
}
void CSelectFileDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSelectFileDlg)
DDX_Text(pDX, IDC_EDIT_FILENAME, m_sSelectedFilename);
DDX_Text(pDX, IDC_EDIT_ROOTELEMSAMPLE, m_sRootElementSample);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSelectFileDlg, CDialog)
//{{AFX_MSG_MAP(CSelectFileDlg)
ON_BN_CLICKED(IDC_BTN_EXPLORE_XSDFILE, OnBtnExploreXSDFile)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSelectFileDlg message handlers
CString CSelectFileDlg::ShowOpenFileDlg(CString filetypes)
{
CFileDialog dlg(TRUE, NULL, NULL, NULL, filetypes);
INT_PTR ret = dlg.DoModal();
if (ret == IDOK) {
return dlg.GetPathName();
}
return "";
}
void CSelectFileDlg::OnBtnExploreXSDFile()
{
CString ret = ShowOpenFileDlg("XML Schema (*.xsd)|*.xsd|All files (*.*)|*.*|");
if (ret.GetLength()) GetDlgItem(IDC_EDIT_FILENAME)->SetWindowText(ret);
}