Fix retrieving the size of item label in native MSW wxListCtrl
Closes https://github.com/wxWidgets/wxWidgets/pull/1461 Closes #11355.
This commit is contained in:
committed by
Vadim Zeitlin
parent
32d8b5954a
commit
da524ebacb
@@ -1247,7 +1247,6 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
|
|||||||
{
|
{
|
||||||
LogEvent(event, "OnListKeyDown");
|
LogEvent(event, "OnListKeyDown");
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( event.GetKeyCode() )
|
switch ( event.GetKeyCode() )
|
||||||
@@ -1325,10 +1324,15 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
|
|||||||
wxLogError("Failed to retrieve rect of item %ld column %d", item, subItem + 1);
|
wxLogError("Failed to retrieve rect of item %ld column %d", item, subItem + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
wxString message = "Bounding rect of %s item %ld column %d is (%d, %d)-(%d, %d)";
|
||||||
wxLogMessage("Bounding rect of item %ld column %d is (%d, %d)-(%d, %d)",
|
wxString part;
|
||||||
item, subItem + 1,
|
if( code == wxLIST_RECT_BOUNDS )
|
||||||
r.x, r.y, r.x + r.width, r.y + r.height);
|
part = "subitem";
|
||||||
|
if( code == wxLIST_RECT_ICON )
|
||||||
|
part = "icon";
|
||||||
|
if( code == wxLIST_RECT_LABEL )
|
||||||
|
part = "label";
|
||||||
|
wxLogMessage( message, part, item, subItem + 1, r.x, r.y, r.x + r.width, r.y + r.height );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -1241,6 +1241,16 @@ bool wxListCtrl::GetSubItemRect(long item, long subItem, wxRect& rect, int code)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if( code == wxLIST_RECT_LABEL )
|
||||||
|
{
|
||||||
|
RECT rectIcon;
|
||||||
|
rectIcon.top = subItem;
|
||||||
|
rectIcon.left = LVIR_ICON;
|
||||||
|
if( !( ::SendMessageA(GetHwnd(), LVM_GETSUBITEMRECT, item, (LPARAM)&rectIcon) ) )
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
rectWin.left = rectIcon.right;
|
||||||
|
}
|
||||||
|
|
||||||
wxCopyRECTToRect(rectWin, rect);
|
wxCopyRECTToRect(rectWin, rect);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user