Skip to content

Commit

Permalink
添加选项的显示对话框。
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoweihan committed Jun 18, 2017
1 parent d927bf2 commit eaa9e5e
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 0 deletions.
102 changes: 102 additions & 0 deletions Src/Edislab/Edislab Pro/DlgDataGroupProperty.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// DlgDataGroupProperty.cpp : 实现文件
//

#include "stdafx.h"
#include "Edislab Pro.h"
#include "DlgDataGroupProperty.h"
#include "Utility.h"

// CDlgDataGroupProperty 对话框

IMPLEMENT_DYNAMIC(CDlgDataGroupProperty, CBaseDialog)

CDlgDataGroupProperty::CDlgDataGroupProperty(const CString& strGroupName,CWnd* pParent /*=NULL*/)
: CBaseDialog(CDlgDataGroupProperty::IDD, pParent),
m_strGroupName(strGroupName)
{

}

CDlgDataGroupProperty::~CDlgDataGroupProperty()
{
}

void CDlgDataGroupProperty::DoDataExchange(CDataExchange* pDX)
{
CBaseDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CDlgDataGroupProperty, CBaseDialog)
ON_BN_CLICKED(ID_BTN_OK, &CDlgDataGroupProperty::OnBnClickedBtnOk)
ON_BN_CLICKED(ID_BTN_CANCEL, &CDlgDataGroupProperty::OnBnClickedBtnCancel)
END_MESSAGE_MAP()


// CDlgDataGroupProperty 消息处理程序


BOOL CDlgDataGroupProperty::OnInitDialog()
{
CBaseDialog::OnInitDialog();

// TODO: 在此添加额外的初始化
InitDisplay();
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}

void CDlgDataGroupProperty::InitDisplay()
{
CWnd* pWnd = GetDlgItem(IDC_DATA_GROUP_NAME);
if (nullptr != pWnd && NULL != pWnd->GetSafeHwnd())
{
pWnd->SetWindowText(m_strGroupName);
}

CTime CurrentTime = CTime::GetCurrentTime();

CString strTime = CurrentTime.Format(_T("%Y-%m-%d %H:%M:%S"));

pWnd = GetDlgItem(IDC_DATA_YIELD_TIME);

if (nullptr != pWnd && NULL != pWnd->GetSafeHwnd())
{
pWnd->SetWindowText(strTime);
}
}


void CDlgDataGroupProperty::OnBnClickedBtnOk()
{
// TODO: 在此添加控件通知处理程序代码
CWnd* pWnd = GetDlgItem(IDC_DATA_GROUP_NAME);
if (nullptr != pWnd && NULL != pWnd->GetSafeHwnd())
{
CString strGroupName;
pWnd->GetWindowText(strGroupName);

if (strGroupName.IsEmpty())
{
Utility::AfxBCGPMessageBox(_T("数组组名不能为空!"),MB_OK | MB_ICONERROR);
return;
}

m_strGroupName = strGroupName;

OnOK();
}

}


void CDlgDataGroupProperty::OnBnClickedBtnCancel()
{
// TODO: 在此添加控件通知处理程序代码
OnCancel();
}

CString CDlgDataGroupProperty::GetGroupName(void)
{
return m_strGroupName;
}
33 changes: 33 additions & 0 deletions Src/Edislab/Edislab Pro/DlgDataGroupProperty.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

#include "BaseDialog.h"
// CDlgDataGroupProperty 对话框

class CDlgDataGroupProperty : public CBaseDialog
{
DECLARE_DYNAMIC(CDlgDataGroupProperty)

public:
CDlgDataGroupProperty(const CString& strGroupName,CWnd* pParent = NULL); // 标准构造函数
virtual ~CDlgDataGroupProperty();

// 对话框数据
enum { IDD = IDD_DLG_DATA_GROUP_PROPERTY };

protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持

DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();

private:
void InitDisplay();

CString m_strGroupName;
public:
afx_msg void OnBnClickedBtnOk();
afx_msg void OnBnClickedBtnCancel();

CString GetGroupName(void);
};
39 changes: 39 additions & 0 deletions Src/Edislab/Edislab Pro/DlgDataSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "GridColumnGroupManager.h"
#include "Utility.h"
#include "Msg.h"
#include "DlgDataGroupProperty.h"
//树的ID
static int s_nTreeID = 10001;

Expand Down Expand Up @@ -62,6 +63,7 @@ BEGIN_MESSAGE_MAP(CDlgDataSetting, CBaseDialog)
ON_BN_CLICKED(IDC_BTN_DEL, &CDlgDataSetting::OnBnClickedBtnDel)
ON_BN_CLICKED(IDC_BTN_ADD_DATA_GROUP, &CDlgDataSetting::OnBnClickedBtnAddDataGroup)
ON_BN_CLICKED(IDC_BTN_ADD_DATA_COLUMN, &CDlgDataSetting::OnBnClickedBtnAddDataColumn)
ON_BN_CLICKED(IDC_BTN_OPT, &CDlgDataSetting::OnBnClickedBtnOpt)
END_MESSAGE_MAP()


Expand Down Expand Up @@ -307,3 +309,40 @@ int CDlgDataSetting::GetTotalRootNum( void )

return nNum;
}


void CDlgDataSetting::OnBnClickedBtnOpt()
{
// TODO: 在此添加控件通知处理程序代码

if (NULL == m_Tree.GetSafeHwnd())
{
return;
}
HTREEITEM hSelectItem = m_Tree.GetSelectedItem();

if (NULL == hSelectItem)
{
return;
}

//判断是否是组节点
if (TRUE == m_Tree.ItemHasChildren(hSelectItem))
{
CString strGroupName = m_Tree.GetItemText(hSelectItem);

CDlgDataGroupProperty Dlg(strGroupName);

if (IDOK == Dlg.DoModal())
{
strGroupName = Dlg.GetGroupName();

m_Tree.SetItemText(hSelectItem,strGroupName);

m_Tree.AdjustLayout();

//通知Grid组名修改
}
}

}
2 changes: 2 additions & 0 deletions Src/Edislab/Edislab Pro/DlgDataSetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ class CDlgDataSetting : public CBaseDialog

private:
std::vector<DEFAULT_GROUP_NAME> m_strDefaultGroupNameArray;
public:
afx_msg void OnBnClickedBtnOpt();
};
Binary file modified Src/Edislab/Edislab Pro/Edislab Pro.rc
Binary file not shown.
2 changes: 2 additions & 0 deletions Src/Edislab/Edislab Pro/Edislab Pro.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
<ClInclude Include="DlgAcquirationPara.h" />
<ClInclude Include="DlgAddPage.h" />
<ClInclude Include="DlgChartSet.h" />
<ClInclude Include="DlgDataGroupProperty.h" />
<ClInclude Include="DlgDataSetting.h" />
<ClInclude Include="DlgDevicePanel.h" />
<ClInclude Include="DlgDeviceSet.h" />
Expand Down Expand Up @@ -301,6 +302,7 @@
<ClCompile Include="DlgAcquirationPara.cpp" />
<ClCompile Include="DlgAddPage.cpp" />
<ClCompile Include="DlgChartSet.cpp" />
<ClCompile Include="DlgDataGroupProperty.cpp" />
<ClCompile Include="DlgDataSetting.cpp" />
<ClCompile Include="DlgDevicePanel.cpp" />
<ClCompile Include="DlgDeviceSet.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions Src/Edislab/Edislab Pro/Edislab Pro.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@
<ClInclude Include="DlgDataSetting.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="DlgDataGroupProperty.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Edislab Pro.cpp">
Expand Down Expand Up @@ -476,6 +479,9 @@
<ClCompile Include="DlgDataSetting.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="DlgDataGroupProperty.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Edislab Pro.rc">
Expand Down
Binary file modified Src/Edislab/Edislab Pro/resource.h
Binary file not shown.

0 comments on commit eaa9e5e

Please sign in to comment.