]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/DragAndDrop.py
SetPath() is now implemented in dirdlg.cpp
[wxWidgets.git] / wxPython / demo / DragAndDrop.py
index 090c162b890e9070eecaa4821ada00e4b10afc44..da17b092998b3149138dd1b12f3070083a51bb96 100644 (file)
@@ -111,6 +111,18 @@ class MyFileDropTarget(wxFileDropTarget):
             self.window.WriteText(file + '\n')
 
 
             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))
+
+    def OnDragOver(self, x, y, d):
+        return wxDragCopy
+
 
 class FileDropPanel(wxPanel):
     def __init__(self, parent, log):
 
 class FileDropPanel(wxPanel):
     def __init__(self, parent, log):
@@ -128,6 +140,14 @@ class FileDropPanel(wxPanel):
         self.text.SetDropTarget(dt)
         sizer.Add(self.text, 1, wxEXPAND)
 
         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)
 
         self.SetAutoLayout(true)
         self.SetSizer(sizer)