Cody Precord wrote:
Hello,
1. I need to distinguish text-change events sent programatically by
calling methods such as InsertText() and those made by the user. If
that's not possible, the next best thing would be to disable event
sending for methods like InsertText(). Any ideas how to do either of
these two things?Not sure, but if you are doing this in an EVT_STC_MODIFIED handler you
I am...
might be able to do it by playing with the bits in SetModEventMask.
Perhaps
SetModEventMask(wx.stc.STC_MOD_DELETETEXT | wx.stc.STC_MOD_DELETETEXT |
wx.stc.STC_PERFORMED_USER)should set it so only events performed by the user fire a modify event
(not tested)
...but it doesn't work. It's like the mask is getting ignored: if I try
your lines (with the mistake of not including INSERTTEXT), it still
generates insert events AND it generates them from calling InsertText()
and other similar functions. All these events have the
STC_PERFORMED_USER flag set.
Is it a known bug? I'm using wxPython 2.8.4
2. I need to delete text from the stc, in a form analogous to calling
InsertText. In other words: I need to delete arbitrary amounts of text
from arbitrary position. I searched the documentation but I can't find
anything like "DeleteText(pos,len)". Any ideas? Marking a selection of
the text and then deleting the selection isn't good enough because it
would interfere with user's own selections.This should work without affecting selection or scroll position (also
not tested...)SetTargetStart(pos)
SetTargetEnd(len)
ReplaceTarget(replaceString)
This works, thanks!
ยทยทยท
On Dec 5, 2007, at 7:54 AM, Ivan Voras wrote: