Make wxTreeCtrl::EnsureVisible() work while frozen in wxMSW
Scrolling the item into view to make it visible didn't work since the
changes of badf6bc300
, which suppressed
scrolling completely while frozen, any longer.
Work around it by remembering the item to make visible and actually
doing it when the control is thawed.
Also add menu item to call Freeze()/Thaw() on wxTreeCtrl in the sample
to make testing this and similar problems easier.
Closes #18435.
This commit is contained in:
@@ -111,6 +111,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
MENU_LINK(DeleteChildren)
|
||||
MENU_LINK(DeleteAll)
|
||||
MENU_LINK(Recreate)
|
||||
MENU_LINK(FreezeThaw)
|
||||
MENU_LINK(ToggleImages)
|
||||
MENU_LINK(ToggleStates)
|
||||
MENU_LINK(ToggleBell)
|
||||
@@ -261,6 +262,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
||||
style_menu->AppendSeparator();
|
||||
style_menu->Append(TreeTest_ResetStyle, "&Reset to default\tF10");
|
||||
|
||||
tree_menu->AppendCheckItem(TreeTest_FreezeThaw, "&Freeze the tree");
|
||||
tree_menu->Append(TreeTest_Recreate, "&Recreate the tree");
|
||||
tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset");
|
||||
tree_menu->AppendSeparator();
|
||||
@@ -664,6 +666,16 @@ void MyFrame::OnDeleteAll(wxCommandEvent& WXUNUSED(event))
|
||||
m_treeCtrl->DeleteAllItems();
|
||||
}
|
||||
|
||||
void MyFrame::OnFreezeThaw(wxCommandEvent& event)
|
||||
{
|
||||
if ( event.IsChecked() )
|
||||
m_treeCtrl->Freeze();
|
||||
else
|
||||
m_treeCtrl->Thaw();
|
||||
|
||||
wxLogMessage("The tree is %sfrozen", m_treeCtrl->IsFrozen() ? "" : "not ");
|
||||
}
|
||||
|
||||
void MyFrame::OnRecreate(wxCommandEvent& event)
|
||||
{
|
||||
OnDeleteAll(event);
|
||||
|
Reference in New Issue
Block a user