bool CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (!m_pList) return false; if (!m_pEdit) return false; m_nSelectItem = -1; switch (nChar) { case FWL_VKEY_Up: if (m_pList->GetCurSel() > 0) { bool bExit = false; #ifdef PDF_ENABLE_XFA if (m_pFillerNotify) { m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); if (bExit) return false; bExit = false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); if (bExit) return false; } #endif // PDF_ENABLE_XFA if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) { if (bExit) return false; SetSelectText(); } } return true; case FWL_VKEY_Down: if (m_pList->GetCurSel() < m_pList->GetCount() - 1) { bool bExit = false; #ifdef PDF_ENABLE_XFA if (m_pFillerNotify) { m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); if (bExit) return false; bExit = false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); if (bExit) return false; } #endif // PDF_ENABLE_XFA if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) { if (bExit) return false; SetSelectText(); } } return true; } if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) return m_pEdit->OnKeyDown(nChar, nFlag); return false; }
void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) { switch (msg) { case PNM_LBUTTONDOWN: if (pWnd == m_pButton) { SetPopup(!m_bPopup); return; } break; case PNM_LBUTTONUP: if (m_pEdit && m_pList) { if (pWnd == m_pList) { SetSelectText(); SelectAll(); m_pEdit->SetFocus(); SetPopup(FALSE); return; } } } CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); }
FX_BOOL CPWL_ComboBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) { if (!m_pList) return FALSE; if (!m_pEdit) return FALSE; m_nSelectItem = -1; switch (nChar) { case FWL_VKEY_Up: if (m_pList->GetCurSel() > 0) { FX_BOOL bExit = FALSE; if (m_pList->OnKeyDownWithExit(nChar,bExit,nFlag)) { if (bExit) return FALSE; SetSelectText(); } } return TRUE; case FWL_VKEY_Down: if (m_pList->GetCurSel() < m_pList->GetCount() - 1) { FX_BOOL bExit = FALSE; if (m_pList->OnKeyDownWithExit(nChar,bExit,nFlag)) { if (bExit) return FALSE; SetSelectText(); } } return TRUE; } if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) return m_pEdit->OnKeyDown(nChar,nFlag); else return FALSE; }