X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..5b119149c0bdefe345c019da29a494180b359aa1:/wxPython/demo/DragAndDrop.py diff --git a/wxPython/demo/DragAndDrop.py b/wxPython/demo/DragAndDrop.py index 090c162b89..59dff7b2b7 100644 --- a/wxPython/demo/DragAndDrop.py +++ b/wxPython/demo/DragAndDrop.py @@ -111,6 +111,16 @@ class MyFileDropTarget(wxFileDropTarget): self.window.WriteText(file + '\n') +class MyTextDropTarget(wxTextDropTarget): + def __init__(self, window, log): + wxTextDropTarget.__init__(self) + self.window = window + self.log = log + + def OnDropText(self, x, y, text): + self.window.WriteText("(%d, %d)\n%s\n" % (x, y, text)) + + class FileDropPanel(wxPanel): def __init__(self, parent, log): @@ -128,6 +138,14 @@ class FileDropPanel(wxPanel): self.text.SetDropTarget(dt) sizer.Add(self.text, 1, wxEXPAND) + sizer.Add(wxStaticText(self, -1, " \nDrag some text here:"), + 0, wxEXPAND|wxALL, 2) + self.text2 = wxTextCtrl(self, -1, "", + style = wxTE_MULTILINE|wxHSCROLL|wxTE_READONLY) + dt = MyTextDropTarget(self.text2, log) + self.text2.SetDropTarget(dt) + sizer.Add(self.text2, 1, wxEXPAND) + self.SetAutoLayout(true) self.SetSizer(sizer)