]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/DragAndDrop.py
wxGLCanvas updates
[wxWidgets.git] / wxPython / demo / DragAndDrop.py
index 090c162b890e9070eecaa4821ada00e4b10afc44..59dff7b2b7ecbcc0a9cc713fa75ecff6ff3dbc69 100644 (file)
@@ -111,6 +111,16 @@ 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))
+
+
 
 class FileDropPanel(wxPanel):
     def __init__(self, parent, log):
 
 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)
 
         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)