OSDN Git Service

Refresh combobox list in OpenDialog when clicking Ok button
authorsdottaka <none@none>
Wed, 20 Jul 2011 16:57:01 +0000 (01:57 +0900)
committersdottaka <none@none>
Wed, 20 Jul 2011 16:57:01 +0000 (01:57 +0900)
Src/OpenView.cpp
Src/OpenView.h

index 90b7a31..395391c 100644 (file)
@@ -172,15 +172,8 @@ void COpenView::OnInitialUpdate()
        m_ctlPath[0].AttachSystemImageList();
        m_ctlPath[1].AttachSystemImageList();
        m_ctlPath[2].AttachSystemImageList();
-       m_ctlPath[0].LoadState(_T("Files\\Left"));
-       m_ctlPath[1].LoadState(_T("Files\\Right"));
-       m_ctlPath[2].LoadState(_T("Files\\Option"));
-       m_ctlExt.LoadState(_T("Files\\Ext"));
-       
-       BOOL bIsEmptyThirdItem = theApp.GetProfileInt(_T("Files\\Option"), _T("Empty"), TRUE);
-       if (bIsEmptyThirdItem)
-               m_ctlPath[2].SetWindowText(_T(""));
-       
+       LoadComboboxStates();
+
        BOOL bDoUpdateData = TRUE;
        for (int index = 0; index < countof(m_strPath); index++)
        {
@@ -416,6 +409,7 @@ void COpenView::OnOK()
 
        SaveComboboxStates();
        theApp.WriteProfileInt(_T("Settings"), _T("Recurse"), m_bRecurse);
+       LoadComboboxStates();
 
        COpenDoc *pDoc = GetDocument();
        pDoc->m_files = m_files;
@@ -444,6 +438,25 @@ void COpenView::OnCancel()
 }
 
 /** 
+ * @brief Load File- and filter-combobox states.
+ */
+void COpenView::LoadComboboxStates()
+{
+       m_ctlPath[0].CComboBox::ResetContent();
+       m_ctlPath[1].CComboBox::ResetContent();
+       m_ctlPath[2].CComboBox::ResetContent();
+
+       m_ctlPath[0].LoadState(_T("Files\\Left"));
+       m_ctlPath[1].LoadState(_T("Files\\Right"));
+       m_ctlPath[2].LoadState(_T("Files\\Option"));
+       m_ctlExt.LoadState(_T("Files\\Ext"));
+       
+       BOOL bIsEmptyThirdItem = theApp.GetProfileInt(_T("Files\\Option"), _T("Empty"), TRUE);
+       if (bIsEmptyThirdItem)
+               m_ctlPath[2].SetWindowText(_T(""));     
+}
+
+/** 
  * @brief Save File- and filter-combobox states.
  */
 void COpenView::SaveComboboxStates()
index 3e74449..3ae7a63 100644 (file)
@@ -112,6 +112,8 @@ protected:
        void TrimPaths();
        void OnButton(int index);
        void OnSelchangeCombo(int index);
+       void LoadComboboxStates();
+       void SaveComboboxStates();
 
 // Generated message map functions
 protected:
@@ -121,7 +123,6 @@ protected:
        afx_msg void OnPath2Button();
        afx_msg void OnOK();
        afx_msg void OnCancel();
-       afx_msg void SaveComboboxStates();
        afx_msg void OnSelchangePath0Combo();
        afx_msg void OnSelchangePath1Combo();
        afx_msg void OnSelchangePath2Combo();