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:
@@ -195,23 +195,38 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
|
|
||||||
bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||||
{
|
{
|
||||||
|
wxString value;
|
||||||
|
int sel = -1;
|
||||||
switch ( param )
|
switch ( param )
|
||||||
{
|
{
|
||||||
case CBN_SELCHANGE:
|
case CBN_SELCHANGE:
|
||||||
if (GetSelection() > -1)
|
sel = GetSelection();
|
||||||
|
if ( sel > -1 )
|
||||||
{
|
{
|
||||||
|
value = GetString(sel);
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
|
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
|
||||||
event.SetInt(GetSelection());
|
event.SetInt(sel);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetString(GetStringSelection());
|
event.SetString(value);
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
break;
|
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:
|
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());
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
|
||||||
event.SetString(GetValue());
|
event.SetString(sel == -1 ? GetValue() : value);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
@@ -235,6 +235,11 @@ void wxListBox::SetupColours()
|
|||||||
SetForegroundColour(GetParent()->GetForegroundColour());
|
SetForegroundColour(GetParent()->GetForegroundColour());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxListBox::HasMultipleSelection() const
|
||||||
|
{
|
||||||
|
return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// implementation of wxListBoxBase methods
|
// implementation of wxListBoxBase methods
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -448,11 +453,6 @@ void wxListBox::DoSetItemClientData(int n, void *clientData)
|
|||||||
wxLogDebug(wxT("LB_SETITEMDATA failed"));
|
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
|
// Return number of selections and an array of selected integers
|
||||||
int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user