DnD Problem between TreeCtrl and Panel

Hi,

I’m writing an app somewhat similar to XRCed, ie a TreeCtrl on the left
and formulars -composed of many controls- to edit on the right.

Selecting an item “A” of the tree ctrl, the formular on the right shows
the data related to this item “A” - of course.

My problem is the following:

I wish to edit a control inside the formular of item “A” by DND’ing
an item “B” of the tree item inside the control (the control to edit will
known which data it must take from the item “B” beeing dragged to fill itself with).

It works fine on Windows, but not on Linux, because as soon as I start the drag operation
(clicking on item “B” in tree ctrl with left mouse kept down),
the formular switchs immediately to the formular of item "B"instead of staying on formular “A” : the edition of the control of item “A” is thus impossible.

How can I solve this? Thanks in advance.

xm

PS: I use the following events:

self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnTreeRightClick) -> show a popo-up menu
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeSelectionChange) -> show the right formular related to the selection
self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDrag) -> DnD start
self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpanding)
self.Bind(wx.EVT_TREE_ITEM_COLLAPSING, self.OnItemCollapsing)
self.Bind(wx.EVT_TREE_KEY_DOWN, self.OnKey)

XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!
Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130

XAVJLM@web.de wrote:

It works fine on Windows, but not on Linux, because as soon as I start the drag operation
(clicking on item "B" in tree ctrl with left mouse kept down),
the formular switchs immediately to the formular of item "B"*instead of staying on formular "A" : the edition of the control of item "A" is thus impossible.*

The root of the difference here is that Windows doesn't send the selection changed event until the mouse-up, but the generic version used on Linux sends it on the mouse-down. You could probably intercept the tree's LEFT_DOWN and LEFT_UP mouse events yourself and manage the changing of the selection in those handlers to be in a way that works better for you.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!