fill in the fields of wxListItem in a wxListEvent before handling the event (closes #10820)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
31cc5049d3
commit
fb4079af5b
@ -380,10 +380,10 @@ class WXDLLIMPEXP_CORE wxListEvent : public wxNotifyEvent
|
||||
public:
|
||||
wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
|
||||
: wxNotifyEvent(commandType, winid)
|
||||
, m_code(0)
|
||||
, m_oldItemIndex(0)
|
||||
, m_itemIndex(0)
|
||||
, m_col(0)
|
||||
, m_code(-1)
|
||||
, m_oldItemIndex(-1)
|
||||
, m_itemIndex(-1)
|
||||
, m_col(-1)
|
||||
, m_pointDrag()
|
||||
, m_item()
|
||||
, m_editCancelled(false)
|
||||
|
@ -2367,13 +2367,18 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
wxZeroMemory(lvhti);
|
||||
|
||||
#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400
|
||||
if(nmhdr->code == GN_CONTEXTMENU) {
|
||||
lvhti.pt = ((NMRGINFO*)nmhdr)->ptAction;
|
||||
} else
|
||||
if ( nmhdr->code == GN_CONTEXTMENU )
|
||||
{
|
||||
lvhti.pt = ((NMRGINFO*)nmhdr)->ptAction;
|
||||
}
|
||||
else
|
||||
#endif //__WXWINCE__
|
||||
::GetCursorPos(&(lvhti.pt));
|
||||
::ScreenToClient(GetHwnd(),&(lvhti.pt));
|
||||
if ( ListView_HitTest(GetHwnd(),&lvhti) != -1 )
|
||||
{
|
||||
::GetCursorPos(&(lvhti.pt));
|
||||
}
|
||||
|
||||
::ScreenToClient(GetHwnd(), &lvhti.pt);
|
||||
if ( ListView_HitTest(GetHwnd(), &lvhti) != -1 )
|
||||
{
|
||||
if ( lvhti.flags & LVHT_ONITEM )
|
||||
{
|
||||
@ -2537,6 +2542,17 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
|
||||
event.SetEventType(eventType);
|
||||
|
||||
// fill in the item before passing it to the event handler if we do have a
|
||||
// valid item index and haven't filled it yet (e.g. for LVN_ITEMCHANGED)
|
||||
if ( event.m_itemIndex != -1 && !event.m_item.GetMask() )
|
||||
{
|
||||
wxListItem& item = event.m_item;
|
||||
|
||||
item.SetId(event.m_itemIndex);
|
||||
item.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE | wxLIST_MASK_DATA);
|
||||
GetItem(item);
|
||||
}
|
||||
|
||||
bool processed = HandleWindowEvent(event);
|
||||
|
||||
// post processing
|
||||
|
Loading…
Reference in New Issue
Block a user