#15166 closed defect (fixed)

wxTreeCtrl loses focus after Freeze and Thaw

Reported by: andrew.derek.ward Owned by: vadz
Priority: normal Milestone: 3.0.0
Component: wxMSW Version: stable-latest
Keywords: wxTreeCtrl wxWindowUpdateLocker Freeze Thaw regression Cc:
Blocked By: Blocking:
Patch: no

Description

This can be reproduced by modifying the treectrl sample to include these lines in MyTreeCtrl::OnTreeKeyDown:

if (event.GetKeyEvent().GetKeyCode() == 'A')
{

wxWindowUpdateLocker noUpdates(this);

}

Then run the sample and press the 'a' key while one of the wxTreeCtrl nodes has focus. After the key has been pressed the wxTreeCtrl no longer has focus.

This did not happen in wxWidgets 2.9.4

Change History (3)

comment:1 Changed 20 months ago by vadz

  • Keywords regression added
  • Milestone changed from 2.9.5 to 3.0

Could you please try to bisect the history to find out which revision exactly broke this?

comment:2 Changed 19 months ago by vadz

  • Owner set to vadz
  • Status changed from new to accepted

This is almost certainly due to r72665... Now the question is what to do about it. We could try to restore the focus back to the control if it had before being hidden, but this risks resulting in more problems (e.g. breaking the user code if it calls SetFocus() in the meanwhile). So maybe better would be to not hide and show it back at all but do something else, e.g. resize it to very small size while it's frozen. Let me experiment with this...

comment:3 Changed 19 months ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [74072]) 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.

Note: See TracTickets for help on using tickets.