diff options
Diffstat (limited to 'fpdfsdk/src/formfiller/FFL_ComboBox.cpp')
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index 012ed4a730..9e58c952aa 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -77,23 +77,28 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie pWnd->AttachFFLData(this); pWnd->Create(cp); + ASSERT(m_pApp != NULL); CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pFormFiller); + ASSERT(m_pWidget != NULL); FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0); + CFX_WideString swText; + if (nCurSel < 0) swText = m_pWidget->GetValue(); else swText = m_pWidget->GetOptionLabel(nCurSel); - + for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); i<sz; i++) { - pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); + pWnd->AddString(m_pWidget->GetOptionLabel(i)); } - + pWnd->SetSelect(nCurSel); - pWnd->SetText(swText.c_str()); + pWnd->SetText(swText); + return pWnd; } @@ -240,7 +245,7 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAc if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) { pEdit->SetSel(fa.nSelStart, fa.nSelEnd); - pEdit->ReplaceSel(fa.sChange.c_str()); + pEdit->ReplaceSel(fa.sChange); } } break; @@ -292,7 +297,7 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) { if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) { - pEdit->SetText(m_State.sValue.c_str()); + pEdit->SetText(m_State.sValue); pEdit->SetSel(m_State.nStart, m_State.nEnd); } } |