#15721 closed defect (fixed)

SIngle-selection tree control gets focus on wxMSW when items are deleted

Reported by: ikamakj Owned by:
Priority: normal Milestone:
Component: wxMSW Version: 2.9.5
Keywords: wxTreeCtrl delete focus Cc:
Blocked By: Blocking:
Patch: no

Description

Tree control items may be deleted in response to a keyboard action in some other window, therefore the deletion should not result in focus change. The MSW implementation of wxTreeCtrl has the problem that item deletion may generate a TVN_SELCHANGING event and the handling of this in wxTreeCtrl::MSWOnNotify() calls SetFocus(). With multiple-selection tree controls this call is prevented during deletion by the m_changingSelection flag being set in wxTreeCtrl::Delete(). Is there any reason why the same could not be done for single-selection controls?

Change History (2)

comment:1 Changed 10 months ago by VZ

(In [75306]) Fix unwanted focus events when deleting a wxTreeCtrl item in wxMSW.

Disable setting focus in response to TVN_SELCHANGING when deleting an item in
a single selection control too -- this was already done in multi selection
case but not in this one, for some reason.

See #15721.

comment:2 Changed 10 months ago by VZ

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

(In [75308]) Fix unwanted focus events when deleting a wxTreeCtrl item in wxMSW.

Disable setting focus in response to TVN_SELCHANGING when deleting an item in
a single selection control too -- this was already done in multi selection
case but not in this one, for some reason.

Also refactor the code to avoid duplicating TreeView_DeleteItem() calls.

Closes #15721.

Note: See TracTickets for help on using tickets.