Drag and drop and notebooks

I am having a problem with drag and drop (specificall drop).

I have two widgets in a notebook (both dervied from listctrl). Both are
wxFileDropTargets. However when I drop, the most recently created one is the
one that receives the files, not the one that is visible.

I am going to work around this by double checking which page is actually
viewable and sending the files on there.

Roger

Roger Binns wrote:

I am having a problem with drag and drop (specificall drop).

I have two widgets in a notebook (both dervied from listctrl). Both are
wxFileDropTargets. However when I drop, the most recently created one is the
one that receives the files, not the one that is visible.

Where is the SetDropTarget called? Does eash widget have a separate instance of wxFileDropTarget?

···

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

Roger Binns wrote:
> I am having a problem with drag and drop (specificall drop).
>
> I have two widgets in a notebook (both dervied from listctrl). Both are
> wxFileDropTargets. However when I drop, the most recently created one is the
> one that receives the files, not the one that is visible.

Where is the SetDropTarget called? Does eash widget have a separate
instance of wxFileDropTarget?

In __init__ and yes. Relevant code is:

class MyFileDropTarget(wxFileDropTarget):
    def __init__(self, target):
        wxFileDropTarget.__init__(self)
        self.target=target

    def OnDropFiles(self, x, y, filenames):
        return self.target.OnDropFiles(x,y,filenames)

class FileView(wxListCtrl, wxListCtrlAutoWidthMixin):
    def __init__(self, mainwindow, parent, id=-1, style=wxLC_REPORT|wxLC_SINGLE_SEL):
        wxListCtrl.__init__(self, parent, id, style=style)
        wxListCtrlAutoWidthMixin.__init__(self)
        self.droptarget=MyFileDropTarget(self)
        self.SetDropTarget(self.droptarget)
        self.mainwindow=mainwindow

Roger

Roger Binns wrote:

Roger Binns wrote:

I am having a problem with drag and drop (specificall drop).

I have two widgets in a notebook (both dervied from listctrl). Both are
wxFileDropTargets. However when I drop, the most recently created one is the
one that receives the files, not the one that is visible.

Where is the SetDropTarget called? Does eash widget have a separate instance of wxFileDropTarget?

In __init__ and yes.

Okay. If you send a runnable minimal sample that shows the problem I'll take a closer look.

···

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