BOOL CSuperComboBox::PreTranslateMessage(MSG* pMsg)
{
- if (m_bAutoComplete
- && pMsg->message == WM_KEYDOWN)
- {
- m_bDoComplete = TRUE;
+ if (pMsg->message == WM_KEYDOWN)
+ {
+ int nVirtKey = (int) pMsg->wParam;
+ // If Shift+Del pressed when dropdown is open, delete selected item
+ // from dropdown list
+ if (GetAsyncKeyState(VK_SHIFT))
+ {
+ if (GetDroppedState() && nVirtKey == VK_DELETE)
+ {
+ int cursel = GetCurSel();
+ if (cursel != CB_ERR)
+ DeleteString(cursel);
+ return FALSE; // No need to further handle this message
+ }
+ }
+ if (m_bAutoComplete)
+ {
+ m_bDoComplete = TRUE;
- int nVirtKey = (int) pMsg->wParam;
- if (nVirtKey == VK_DELETE || nVirtKey == VK_BACK)
- m_bDoComplete = FALSE;
- }
+ if (nVirtKey == VK_DELETE || nVirtKey == VK_BACK)
+ m_bDoComplete = FALSE;
+ }
+ }
- return CComboBox::PreTranslateMessage(pMsg);
+ return CComboBox::PreTranslateMessage(pMsg);
}
void CSuperComboBox::SetAutoAdd(BOOL bAdd, UINT idstrAddText)
mf->m_options.SaveOption(OPT_FILEFILTER_CURRENT, m_strExt);
}
- m_ctlLeft.SaveState(_T("Files\\Left"));
- m_ctlRight.SaveState(_T("Files\\Right"));
- m_ctlExt.SaveState(_T("Files\\Ext"));
-
+ SaveComboboxStates();
theApp.WriteProfileInt(_T("Settings"), _T("Recurse"), m_bRecurse);
CDialog::OnOK();
}
+/**
+ * @brief Called when dialog is closed via Cancel.
+ *
+ * Open-dialog is canceled when 'Cancel' button is selected or
+ * Esc-key is pressed. Save combobox states, since user may have
+ * removed items from them and don't want them to re-appear.
+ */
+void COpenDlg::OnCancel()
+{
+ SaveComboboxStates();
+ CDialog::OnCancel();
+}
+
+/**
+ * @brief Save File- and filter-combobox states.
+ */
+void COpenDlg::SaveComboboxStates()
+{
+ m_ctlLeft.SaveState(_T("Files\\Left"));
+ m_ctlRight.SaveState(_T("Files\\Right"));
+ m_ctlExt.SaveState(_T("Files\\Ext"));
+}
+
/** @brief Handler for WM_INITDIALOG; conventional location to initialize controls */
BOOL COpenDlg::OnInitDialog()
{
afx_msg void OnRightButton();
afx_msg void OnSaveProjectButton();
virtual void OnOK();
+ virtual void OnCancel();
+ afx_msg void SaveComboboxStates();
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeLeftCombo();
afx_msg void OnSelchangeRightCombo();
+2005-06-06 Kimmo
+ PATCH: [ 1215235 ] Allow removing items from comboboxes
+ Src: OpenDlg.cpp OpenDlg.h
+ Src/Common: SuperComboBox.cpp
+
2005-06-05 Tim
RFE: [ 1203923 ] New refresh icon
Src/res: Toolbar.bmp