// BootOptPage.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "BootOptPage.h" #include ".\BootOptPage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CBootOptPage property page IMPLEMENT_DYNCREATE(CBootOptPage, CCfgPropPage) CBootOptPage::CBootOptPage() : CCfgPropPage(CBootOptPage::IDD) { //{{AFX_DATA_INIT(CBootOptPage) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } CBootOptPage::~CBootOptPage() { } void CBootOptPage::DoDataExchange(CDataExchange* pDX) { CCfgPropPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CBootOptPage) //}}AFX_DATA_MAP DDX_Control(pDX, IDC_STATIC_BOOTOPT_PAGE, m_BootOptPageLabel); } BEGIN_MESSAGE_MAP(CBootOptPage, CCfgPropPage) //{{AFX_MSG_MAP(CBootOptPage) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CBootOptPage message handlers BOOL CBootOptPage::OnSetActive() { // TODO: Add your specialized code here and/or call the base class if (s.ReloadCfg) { InitControls(); } return CCfgPropPage::OnSetActive(); } BOOL CBootOptPage::OnInitDialog() { CCfgPropPage::OnInitDialog(); m_BootOptPageLabel .SetFontName("Arial") .SetFontSize(24) .SetTextColor(RGB(0,0,255)) .SetBkColor(RGB(244, 243, 238)) .SetFontItalic(TRUE) .SetFontBold(TRUE); InitControls(); // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CBootOptPage::InitControls() { HWND hPage = this->GetSafeHwnd(); } void CBootOptPage::InitDlgItem(HWND hDlg, DP5_CONFIGURATION cfg) { int cboDP5CtrlID = cfg.ListCtrlID; int txtDP5CtrlID = cfg.TextCtrlID; CString cstrVal = cfg.Setting; int idxList; CString cstrUnits; CString cstrLimits; if ((cfg.CtrlType & dctCbo) > 0) { // try to find list index for any combo CComboBox &cb = *(CComboBox *) GetDlgItem(cboDP5CtrlID); idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,cstrVal); if (idxList == LB_ERR) { // if (idxList != LB_ERR) we already found the value if ((cfg.CtrlType & dctTxt) > 0) { // if cbotxt must find mask, else set to 0 idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"#"); if (idxList == LB_ERR) { // mask begins with + idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"+"); } if (idxList == LB_ERR) { // mask begins with - idxList = s.CtrlUtil.FindCboIdx(hDlg,cboDP5CtrlID,"-"); } if (idxList == LB_ERR) { // not found default to 0 idxList = 0; } } else { idxList = 0; // set to first item } } cb.SetCurSel(idxList); } } // pass dci id to update combo control and display edit controls if any void CBootOptPage::CboUpdate(int nID_dci) { CString cstrCboText; int nID; nID = s.m_DP5Cfg[nID_dci].ListCtrlID; if (nID == NULL) { return; } CComboBox &cb = *(CComboBox *) GetDlgItem(nID); int idx = cb.GetCurSel(); if (idx > LB_ERR) { cb.GetLBText(idx,cstrCboText); s.m_DP5Cfg[nID_dci].ComboIndex = idx; s.m_DP5Cfg[nID_dci].ComboValue = cstrCboText; } else { return; } }