- wxCHECK_RET( N >= 0 && N < m_noItems,
- _T("invalid index in wxListBox::SetClientData") );
+ DoSetItemClientData(n, clientData);
+}
+
+void wxListBox::DoSetItemClientData(int n, void *clientData)
+{
+ wxCHECK_RET( n >= 0 && n < m_noItems,
+ wxT("invalid index in wxListBox::SetClientData") );
+
+#if wxUSE_OWNER_DRAWN
+ if ( m_windowStyle & wxLB_OWNERDRAW )
+ {
+ // client data must be pointer to wxOwnerDrawn, otherwise we would crash
+ // in OnMeasure/OnDraw.
+ wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
+ }
+#endif // wxUSE_OWNER_DRAWN
+
+ if ( ListBox_SetItemData(GetHwnd(), n, clientData) == LB_ERR )
+ wxLogDebug(wxT("LB_SETITEMDATA failed"));
+}