Avoid spurious errors when getting wxChoice or wxListBox client data in wxMSW.
Even after the changes of r70415, we could still report an error when the item client data was set to -1 (== CB_ERR) as checking for GetLastError() was not enough, we need to also ensure that the last error is reset before trying to get the client data. Also apply the same fix to wxListBox and add the tests verifying that this does work correctly. Closes #13883. Also fix wxListBox::GetClientData(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74994 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -304,6 +304,10 @@ bool wxListBox::IsSelected(int N) const
|
||||
|
||||
void *wxListBox::DoGetItemClientData(unsigned int n) const
|
||||
{
|
||||
// This is done here for the same reasons as in wxChoice method with the
|
||||
// same name.
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
LPARAM rc = SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
|
||||
if ( rc == LB_ERR && GetLastError() != ERROR_SUCCESS )
|
||||
{
|
||||
|
Reference in New Issue
Block a user