[wxPython-users] STC: events & deleting
Cody Precord
codyprecord at gmail.com
Wed Dec 5 06:07:52 PST 2007
Hello,
On Dec 5, 2007, at 7:54 AM, Ivan Voras wrote:
> Hi,
>
> I have two questions about the stc text editor control:
>
> 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 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)
> 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)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-
> help at lists.wxwidgets.org
>
Regards,
Cody Precord
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20071205/a6f12442/attachment.htm
More information about the wxpython-users
mailing list