small updates

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7734 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-07-11 04:49:30 +00:00
parent e44fed2cb2
commit 262804532c
8 changed files with 289 additions and 1 deletions

View File

@@ -45,10 +45,59 @@ else:
pb = 10
#----------------------------------------------------------------------
# This shows how to catch the Modified event from the wxStyledTextCtrl
class MySTC(wxStyledTextCtrl):
def __init__(self, parent, ID, log):
wxStyledTextCtrl.__init__(self, parent, ID)
self.log = log
EVT_STC_MODIFIED(self, ID, self.OnModified)
def OnModified(self, evt):
self.log.write("""OnModified
Mod type: %s
At position: %d
Lines added: %d
Text Length: %d
Text: %s\n""" % ( self.transModType(evt.GetModificationType()),
evt.GetPosition(),
evt.GetLinesAdded(),
evt.GetLength(),
evt.GetText() ))
def transModType(self, modType):
st = ""
table = [(wxSTC_MOD_INSERTTEXT, "InsertText"),
(wxSTC_MOD_DELETETEXT, "DeleteText"),
(wxSTC_MOD_CHANGESTYLE, "ChangeStyle"),
(wxSTC_MOD_CHANGEFOLD, "ChangeFold"),
(wxSTC_PERFORMED_USER, "UserFlag"),
(wxSTC_PERFORMED_UNDO, "Undo"),
(wxSTC_PERFORMED_REDO, "Redo"),
(wxSTC_LASTSTEPINUNDOREDO, "Last-Undo/Redo"),
(wxSTC_MOD_CHANGEMARKER, "ChangeMarker"),
(wxSTC_MOD_BEFOREINSERT, "B4-Insert"),
(wxSTC_MOD_BEFOREDELETE, "B4-Delete")
]
for flag,text in table:
if flag & modType:
st = st + text + " "
if not st:
st = 'UNKNOWN'
return st
#----------------------------------------------------------------------
def runTest(frame, nb, log):
ed = wxStyledTextCtrl(nb, -1)
ed = MySTC(nb, -1, log)
ed.SetText(demoText)
ed.EmptyUndoBuffer()