- wxCHECK_RET( pos >= 0 && pos <= m_noItems,
- _T("invalid index in wxListBox::InsertItems") );
-
- int i;
- for (i = 0; i < nItems; i++)
- ListBox_InsertString(GetHwnd(), i + pos, items[i]);
- m_noItems += nItems;
-
- SetHorizontalExtent(_T(""));
-}
-
-void wxListBox::SetString(int N, const wxString& s)
-{
- wxCHECK_RET( N >= 0 && N < m_noItems,
- _T("invalid index in wxListBox::SetString") );
-
- int sel = -1;
- if (!(m_windowStyle & wxLB_MULTIPLE) && !(m_windowStyle & wxLB_EXTENDED))
- sel = GetSelection();
-
- void *oldData = wxListBox::GetClientData(N);
-
- SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
+ // find the widest string
+ int wLine;
+ int wListbox = 0;
+ for ( int i = 0; i < m_noItems; i++ )
+ {
+ wxString str(GetString(i));
+ GetTextExtent(str, &wLine, NULL);
+ if ( wLine > wListbox )
+ wListbox = wLine;
+ }