Added URL drag and drop sample to the wxPython demo

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12167 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-10-26 02:13:11 +00:00
parent e6d318c25a
commit 846ec2f9ed
3 changed files with 144 additions and 1 deletions

View File

@@ -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)