X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dbace455c0416abe52fc44eb5e5e0d1bccc1c160..9859d369b49e35a1cad0f760173e165f974fb6cb:/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp diff --git a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp index 6cded83c61..1fbe0b94e9 100644 --- a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp +++ b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp @@ -1336,7 +1336,7 @@ int wxTreeListHeaderWindow::XToCol(int x) void wxTreeListHeaderWindow::RefreshColLabel(int col) { - if ( col > GetColumnCount() ) + if ( col >= GetColumnCount() ) return; int x = 0; @@ -3600,7 +3600,7 @@ void wxTreeListMainWindow::OnChar (wxKeyEvent &event) { default: if (event.GetKeyCode() >= (int)' ') { if (!m_findTimer->IsRunning()) m_findStr.Clear(); - m_findStr.Append (event.GetKeyCode()); + m_findStr.Append ((char)event.GetKeyCode()); m_findTimer->Start (FIND_TIMER_TICKS, wxTIMER_ONE_SHOT); wxTreeItemId prev = m_curItem? (wxTreeItemId*)m_curItem: (wxTreeItemId*)NULL; while (true) { @@ -4681,6 +4681,18 @@ int wxTreeListCtrl::GetColumnCount() const void wxTreeListCtrl::SetColumnWidth(int column, int width) { + if (width == wxLIST_AUTOSIZE_USEHEADER) + { + wxFont font = m_header_win->GetFont(); + m_header_win->GetTextExtent(m_header_win->GetColumnText(column), &width, NULL, NULL, NULL, font.Ok()? &font: NULL); + //search wxTreeListHeaderWindow::OnPaint to understand this: + width += 2*EXTRA_WIDTH + MARGIN; + } + else if (width == wxLIST_AUTOSIZE) + { + width = m_main_win->GetBestColumnWidth(column); + } + m_header_win->SetColumnWidth (column, width); m_header_win->Refresh(); }