Change wxMSW wxTreeCtrl::DoFreeze() to not hide the tree any more.

Hiding the tree when it's frozen, as done in r72665, results in its own
problems, e.g. loss of focus. So don't do this but resize the control to a
very small size when freezing it and restore it to its old size afterwards.

Closes #15166.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74072 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-05-31 23:21:36 +00:00
parent 926df8a162
commit 4e1e8dc51b
4 changed files with 50 additions and 8 deletions

View File

@@ -30,6 +30,7 @@
#include "wx/treectrl.h"
#include "wx/math.h"
#include "wx/renderer.h"
#include "wx/wupdlock.h"
#ifdef __WIN32__
// this is not supported by native control
@@ -122,6 +123,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
MENU_LINK(EnsureVisible)
MENU_LINK(SetFocus)
MENU_LINK(AddItem)
MENU_LINK(AddManyItems)
MENU_LINK(InsertItem)
MENU_LINK(IncIndent)
MENU_LINK(DecIndent)
@@ -264,6 +266,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
tree_menu->Append(TreeTest_CollapseAndReset, wxT("C&ollapse and reset"));
tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_AddItem, wxT("Append a &new item"));
tree_menu->Append(TreeTest_AddManyItems, wxT("Appends &many items"));
tree_menu->Append(TreeTest_InsertItem, wxT("&Insert a new item"));
tree_menu->Append(TreeTest_Delete, wxT("&Delete this item"));
tree_menu->Append(TreeTest_DeleteChildren, wxT("Delete &children"));
@@ -782,6 +785,17 @@ void MyFrame::OnAddItem(wxCommandEvent& WXUNUSED(event))
MyTreeCtrl::TreeCtrlIcon_File */ );
}
void MyFrame::OnAddManyItems(wxCommandEvent& WXUNUSED(event))
{
wxWindowUpdateLocker lockUpdates(this);
const wxTreeItemId root = m_treeCtrl->GetRootItem();
for ( int n = 0; n < 1000; n++ )
{
m_treeCtrl->AppendItem(root, wxString::Format("Item #%03d", n));
}
}
void MyFrame::OnIncIndent(wxCommandEvent& WXUNUSED(event))
{
unsigned int indent = m_treeCtrl->GetIndent();