I have a wxPython program where I want to be able to drag groups of controls around to reorder them. Each group of controls is on a panel, and I want the panel object to handle the drag-and-drop.
Currently it works if you click and drag on the panel itself, but it doesn't work if you click on any control inside the panel. This is because the wx.EVT_LEFT_DOWN event that I am using to trigger the drag is not a command event, so is not propagated up to the parent panel.
The only way I can think of to get round this is to bind that event to the panel's handler for every control on the panel.
This does not seem very elegant to me - either I have to explicitly do it when I create each child event, which breaks encapsulation, or the panel recurses through the child controls and does the binding - this seems dangerous, since the individual controls may already be using that event for other purposes. Ideally I would like the controls on the panel to not need to know anything about the DnD.
Does anyone know of any alternative solutions? Are there any command events that I could use to initiate dragging? Or anything else I haven't thought of?