Do not switch state if drag-and-drop is not allowed in wxTreeCtrl

Avoid setting state to DragSelectingState unless dragging items in
wxTreeCtrl is explicitly allowed, as this this causes bad behaviour
downstream with subsequent selections when the client does anything in
the event handler beyond simply not allowing the event.

Basically, we can't be guaranteed of the mouse state on return from the
event handler, so dropping into drag selection mode is potentially
inappropriate (or just plain bad).

Closes https://github.com/wxWidgets/wxWidgets/pull/1523
This commit is contained in:
Jay Nabonne
2019-09-02 10:59:06 +01:00
committed by Vadim Zeitlin
parent 337644f702
commit cd9a8fb695

View File

@@ -463,14 +463,14 @@ private:
tree_event.SetPoint(wxQtConvertPoint(event->pos())); tree_event.SetPoint(wxQtConvertPoint(event->pos()));
// Vetoed unless explicitly accepted. // Client must explicitly accept drag and drop. Vetoed by default.
tree_event.Veto(); tree_event.Veto();
EmitEvent(tree_event); EmitEvent(tree_event);
if ( !tree_event.IsAllowed() ) if ( !tree_event.IsAllowed() )
{ {
setState(DragSelectingState); setState(NoState);
} }
} }