indicate whether this is a selection or a deselection in wxCommandEvent generated by a multiselection wxListBox

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-02-02 03:05:41 +00:00
parent cf41e1a4d5
commit 9c9c3d7a8f
3 changed files with 16 additions and 17 deletions

View File

@@ -49,7 +49,7 @@
#endif
#endif
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
// ============================================================================
// list box item declaration and implementation
@@ -675,20 +675,17 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
wxCommandEvent event(evtType, m_windowId);
event.SetEventObject( this );
wxArrayInt aSelections;
int n, count = GetSelections(aSelections);
if ( count > 0 )
// retrieve the affected item
int n = SendMessage(GetHwnd(), LB_GETCARETINDEX, 0, 0);
if ( n != LB_ERR )
{
n = aSelections[0];
if ( HasClientObjectData() )
event.SetClientObject( GetClientObject(n) );
else if ( HasClientUntypedData() )
event.SetClientData( GetClientData(n) );
event.SetString( GetString(n) );
}
else
{
n = -1;
event.SetExtraLong( HasMultipleSelection() ? IsSelected(n) : TRUE );
}
event.m_commandInt = n;