Commit 2fddd621 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

comctl32/listbox: Use a helper to set item data by index.

parent 9f3a187f
...@@ -161,6 +161,11 @@ static ULONG_PTR get_item_data( const LB_DESCR *descr, UINT index ) ...@@ -161,6 +161,11 @@ static ULONG_PTR get_item_data( const LB_DESCR *descr, UINT index )
return (descr->style & LBS_NODATA) ? 0 : descr->items[index].data; return (descr->style & LBS_NODATA) ? 0 : descr->items[index].data;
} }
static void set_item_data( LB_DESCR *descr, UINT index, ULONG_PTR data )
{
if (!(descr->style & LBS_NODATA)) descr->items[index].data = data;
}
static WCHAR *get_item_string( const LB_DESCR *descr, UINT index ) static WCHAR *get_item_string( const LB_DESCR *descr, UINT index )
{ {
return HAS_STRINGS(descr) ? descr->items[index].str : NULL; return HAS_STRINGS(descr) ? descr->items[index].str : NULL;
...@@ -2684,7 +2689,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam, ...@@ -2684,7 +2689,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam,
SetLastError(ERROR_INVALID_INDEX); SetLastError(ERROR_INVALID_INDEX);
return LB_ERR; return LB_ERR;
} }
if (!(descr->style & LBS_NODATA)) descr->items[wParam].data = lParam; set_item_data(descr, wParam, lParam);
/* undocumented: returns TRUE, not LB_OKAY (0) */ /* undocumented: returns TRUE, not LB_OKAY (0) */
return TRUE; return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment