wxComboBox sends TEXT_UPDATED event under MSW when selection changes now too

(no changes in other files)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8312 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-09-09 19:40:01 +00:00
parent ed152d040a
commit b8e3e48747
5 changed files with 35 additions and 20 deletions

View File

@@ -195,23 +195,38 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{
wxString value;
int sel = -1;
switch ( param )
{
case CBN_SELCHANGE:
if (GetSelection() > -1)
sel = GetSelection();
if ( sel > -1 )
{
value = GetString(sel);
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
event.SetInt(GetSelection());
event.SetInt(sel);
event.SetEventObject(this);
event.SetString(GetStringSelection());
event.SetString(value);
ProcessCommand(event);
}
else
{
break;
}
// fall through: for compability with wxGTK, also send the text
// update event when the selection changes (this also seems more
// logical as the text does change)
case CBN_EDITCHANGE:
{
// if sel != -1, value was initialized above (and we can't use
// GetValue() here as it would return the old selection and we
// want the new one)
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
event.SetString(GetValue());
event.SetString(sel == -1 ? GetValue() : value);
event.SetEventObject(this);
ProcessCommand(event);
}

View File

@@ -235,6 +235,11 @@ void wxListBox::SetupColours()
SetForegroundColour(GetParent()->GetForegroundColour());
}
bool wxListBox::HasMultipleSelection() const
{
return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
}
// ----------------------------------------------------------------------------
// implementation of wxListBoxBase methods
// ----------------------------------------------------------------------------
@@ -448,11 +453,6 @@ void wxListBox::DoSetItemClientData(int n, void *clientData)
wxLogDebug(wxT("LB_SETITEMDATA failed"));
}
bool wxListBox::HasMultipleSelection() const
{
return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
}
// Return number of selections and an array of selected integers
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{