Added Test for wxComboBox::SetValue() to widgets sample.
Make wxGTK not send text change events then. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45672 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3dd2cf729d
commit
21dd7c5b4c
@ -68,6 +68,8 @@ enum
|
|||||||
ComboPage_Delete,
|
ComboPage_Delete,
|
||||||
ComboPage_DeleteText,
|
ComboPage_DeleteText,
|
||||||
ComboPage_DeleteSel,
|
ComboPage_DeleteSel,
|
||||||
|
ComboPage_SetValue,
|
||||||
|
ComboPage_SetValueText,
|
||||||
ComboPage_Combo
|
ComboPage_Combo
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,6 +107,7 @@ protected:
|
|||||||
void OnButtonAdd(wxCommandEvent& event);
|
void OnButtonAdd(wxCommandEvent& event);
|
||||||
void OnButtonAddSeveral(wxCommandEvent& event);
|
void OnButtonAddSeveral(wxCommandEvent& event);
|
||||||
void OnButtonAddMany(wxCommandEvent& event);
|
void OnButtonAddMany(wxCommandEvent& event);
|
||||||
|
void OnButtonSetValue(wxCommandEvent& event);
|
||||||
void OnButtonSetCurrent(wxCommandEvent& event);
|
void OnButtonSetCurrent(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnComboBox(wxCommandEvent& event);
|
void OnComboBox(wxCommandEvent& event);
|
||||||
@ -147,6 +150,7 @@ protected:
|
|||||||
wxTextCtrl *m_textInsert,
|
wxTextCtrl *m_textInsert,
|
||||||
*m_textAdd,
|
*m_textAdd,
|
||||||
*m_textChange,
|
*m_textChange,
|
||||||
|
*m_textSetValue,
|
||||||
*m_textDelete,
|
*m_textDelete,
|
||||||
*m_textCur;
|
*m_textCur;
|
||||||
|
|
||||||
@ -169,6 +173,7 @@ BEGIN_EVENT_TABLE(ComboboxWidgetsPage, WidgetsPage)
|
|||||||
EVT_BUTTON(ComboPage_Add, ComboboxWidgetsPage::OnButtonAdd)
|
EVT_BUTTON(ComboPage_Add, ComboboxWidgetsPage::OnButtonAdd)
|
||||||
EVT_BUTTON(ComboPage_AddSeveral, ComboboxWidgetsPage::OnButtonAddSeveral)
|
EVT_BUTTON(ComboPage_AddSeveral, ComboboxWidgetsPage::OnButtonAddSeveral)
|
||||||
EVT_BUTTON(ComboPage_AddMany, ComboboxWidgetsPage::OnButtonAddMany)
|
EVT_BUTTON(ComboPage_AddMany, ComboboxWidgetsPage::OnButtonAddMany)
|
||||||
|
EVT_BUTTON(ComboPage_SetValue, ComboboxWidgetsPage::OnButtonSetValue)
|
||||||
EVT_BUTTON(ComboPage_SetCurrent, ComboboxWidgetsPage::OnButtonSetCurrent)
|
EVT_BUTTON(ComboPage_SetCurrent, ComboboxWidgetsPage::OnButtonSetCurrent)
|
||||||
|
|
||||||
EVT_TEXT_ENTER(ComboPage_InsertText, ComboboxWidgetsPage::OnButtonInsert)
|
EVT_TEXT_ENTER(ComboPage_InsertText, ComboboxWidgetsPage::OnButtonInsert)
|
||||||
@ -320,6 +325,14 @@ void ComboboxWidgetsPage::CreateContent()
|
|||||||
btn = new wxButton(this, ComboPage_Clear, _T("&Clear"));
|
btn = new wxButton(this, ComboPage_Clear, _T("&Clear"));
|
||||||
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
||||||
|
|
||||||
|
sizerRow = CreateSizerWithTextAndButton(ComboPage_SetValue,
|
||||||
|
_T("SetValue"),
|
||||||
|
ComboPage_SetValueText,
|
||||||
|
&m_textSetValue);
|
||||||
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// right pane
|
// right pane
|
||||||
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
|
||||||
m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString,
|
m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString,
|
||||||
@ -457,6 +470,12 @@ void ComboboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ComboboxWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxString value = m_textSetValue->GetValue();
|
||||||
|
m_combobox->SetValue( value );
|
||||||
|
}
|
||||||
|
|
||||||
void ComboboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
void ComboboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_combobox->Clear();
|
m_combobox->Clear();
|
||||||
|
@ -946,7 +946,10 @@ void wxComboBox::SetValue( const wxString& value )
|
|||||||
|
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
if (!value.IsNull()) tmp = value;
|
if (!value.IsNull()) tmp = value;
|
||||||
|
|
||||||
|
DisableEvents();
|
||||||
gtk_entry_set_text( entry, wxGTK_CONV( tmp ) );
|
gtk_entry_set_text( entry, wxGTK_CONV( tmp ) );
|
||||||
|
EnableEvents();
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user