Demo tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17855 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -124,7 +124,8 @@ class DoodleDropTarget(wxPyDropTarget):
|
|||||||
self.dv = window
|
self.dv = window
|
||||||
|
|
||||||
# specify the type of data we will accept
|
# specify the type of data we will accept
|
||||||
self.data = wxCustomDataObject(wxCustomDataFormat("DoodleLines"))
|
self.df = wxCustomDataFormat("DoodleLines")
|
||||||
|
self.data = wxCustomDataObject(self.df)
|
||||||
self.SetDataObject(self.data)
|
self.SetDataObject(self.data)
|
||||||
|
|
||||||
|
|
||||||
@@ -326,21 +327,20 @@ if __name__ == '__main__':
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
overview = """<html><body>
|
||||||
|
This demo shows Drag and Drop using a custom data type and a custom
|
||||||
|
data object. A type called "DoodleLines" is created and a Python
|
||||||
|
Pickle of a list is actually transfered in the drag and drop
|
||||||
|
opperation.
|
||||||
|
|
||||||
|
A second data object is also created containing a bitmap of the image
|
||||||
|
and is made available to any drop target that accepts bitmaps, such as
|
||||||
|
MS Word.
|
||||||
|
|
||||||
|
The two data objects are combined in a wxDataObjectComposite and the
|
||||||
|
rest is handled by the framework.
|
||||||
|
</body></html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overview = """\
|
|
||||||
This demo shows Drag and Drop using a custom data type and a custom data object. A type called "DoodleLines" is created and a Python Pickle of a list is actually transfered in the drag and drop opperation.
|
|
||||||
|
|
||||||
A second data object is also created containing a bitmap of the image and is made available to any drop target that accepts bitmaps, such as MS Word.
|
|
||||||
|
|
||||||
The two data objects are combined in a wxDataObjectComposite and the rest is handled by the framework.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -10,10 +10,12 @@ class wxFindPrefixListBox(wxListBox):
|
|||||||
choices=[], style=0, validator=wxDefaultValidator):
|
choices=[], style=0, validator=wxDefaultValidator):
|
||||||
wxListBox.__init__(self, parent, id, pos, size, choices, style, validator)
|
wxListBox.__init__(self, parent, id, pos, size, choices, style, validator)
|
||||||
self.typedText = ''
|
self.typedText = ''
|
||||||
EVT_KEY_UP(self, self.OnKey)
|
self.log = parent.log
|
||||||
|
EVT_KEY_DOWN(self, self.OnKey)
|
||||||
|
|
||||||
|
|
||||||
def FindPrefix(self, prefix):
|
def FindPrefix(self, prefix):
|
||||||
|
self.log.WriteText('Looking for prefix: %s\n' % prefix)
|
||||||
if prefix:
|
if prefix:
|
||||||
prefix = string.lower(prefix)
|
prefix = string.lower(prefix)
|
||||||
length = len(prefix)
|
length = len(prefix)
|
||||||
@@ -21,7 +23,9 @@ class wxFindPrefixListBox(wxListBox):
|
|||||||
text = self.GetString(x)
|
text = self.GetString(x)
|
||||||
text = string.lower(text)
|
text = string.lower(text)
|
||||||
if text[:length] == prefix:
|
if text[:length] == prefix:
|
||||||
|
self.log.WriteText('Prefix %s is found.\n' % prefix)
|
||||||
return x
|
return x
|
||||||
|
self.log.WriteText('Prefix %s is not found.\n' % prefix)
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
|
||||||
@@ -43,8 +47,12 @@ class wxFindPrefixListBox(wxListBox):
|
|||||||
self.SetSelection(item)
|
self.SetSelection(item)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
self.typedText = ''
|
||||||
evt.Skip()
|
evt.Skip()
|
||||||
|
|
||||||
|
def OnKeyDown(self, evt):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -213,10 +213,11 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
|
|||||||
# this does
|
# this does
|
||||||
self.list.SetItemState(10, 0, wxLIST_STATE_SELECTED)
|
self.list.SetItemState(10, 0, wxLIST_STATE_SELECTED)
|
||||||
|
|
||||||
# Show how to reselect something we don't want deselected
|
|
||||||
def OnItemDeselected(self, evt):
|
def OnItemDeselected(self, evt):
|
||||||
item = evt.GetItem()
|
item = evt.GetItem()
|
||||||
print evt.m_itemIndex
|
self.log.WriteText("OnItemDeselected: %d" % evt.m_itemIndex)
|
||||||
|
|
||||||
|
# Show how to reselect something we don't want deselected
|
||||||
if evt.m_itemIndex == 11:
|
if evt.m_itemIndex == 11:
|
||||||
wxCallAfter(self.list.SetItemState, 11, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED)
|
wxCallAfter(self.list.SetItemState, 11, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED)
|
||||||
|
|
||||||
|
@@ -30,7 +30,9 @@ class TestTreeCtrlPanel(wxPanel):
|
|||||||
tID = NewId()
|
tID = NewId()
|
||||||
|
|
||||||
self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
|
self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
|
||||||
wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS# | wxTR_MULTIPLE
|
wxTR_HAS_BUTTONS
|
||||||
|
| wxTR_EDIT_LABELS
|
||||||
|
#| wxTR_MULTIPLE
|
||||||
#| wxTR_HIDE_ROOT
|
#| wxTR_HIDE_ROOT
|
||||||
, self.log)
|
, self.log)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user