Some questions on StyledTextCtrl????

Franz Steinh?usler:

======= 2005-03-16 15:14:05 Franz Steinh?usler wrote: =======

Hi,

Lately I'm working with StyledTextCtrl, and I have several questions here:

   1) Where can we find any documents for STC? the __doc__ is too simple.

Look at http://www.yellowbrain.com/stc/index.html

it's helpful

I have downloaded it with webreaper and you could download
the zipped file from my site:

http://mitglied.lycos.de/drpython/stc_doc.zip

to have it offline.

I can't access your site,:-< , so I could only download it myself.

(I hope, there is no problem with the license)

What about including this into wxPython distribution?

   2) I have some codes like this:

self.Bind(stc.EVT_STC_MODIFIED, self._OnModified)
...
def _OnModified(self, evt):
   if XXX:
       ## Veto
   else:
       evt.Skip()

   this evt doesn't have a Veto method, so how to undo the text modification ??

I don't quit understand. Calling Undo() for undo last change of text
isn't enough?

     I don't want STC record the character deleting action. I have set some lines in the STC as special lines which cannot be editable. So once user type in characters in these lines, the STC is expected to ignore them.

3) I find that once I type in ONE character, the _OnModified() is called twice! Why?

Hm, don't know.

"""
You can control what types of modifications will fire a EVT_STC_MODIFIED
event with the SetModEventMask command.
"""

this may be what I need.

You could use a print statement, to investigate the types of events.
see in the doc: m_modificationType

modtype = event.GetModificationType()

for example;
modtype is wx.stc.STC_MOD_DELETETEXT? or wx.stc.STC_PERFORMED_UNDO

   4) How to test whether a line has a marker?

from the doc: MarkerGet(line)

"""
Returns a 32-bit integer object that has a bit set for each marker in
the line specified by the integer parameter line. For example, if bit 1
was set then that line would have the marker symbol associated with bit
1.
"""

   5) How to catch a CHAR event that is made by user, not the SetText?

Overwrite:

  self.Bind(wx.EVT_CHAR, self.OnChar)
  self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

I think this can also solve my second question.

thanks for your help!

HTH

Cheers,

--
Franz Steinhaeusler

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

= = = = = = = = = = = = = = = = = = = =
      
Bruce Who
HuXuZhao@hotmail.com
2005-03-16

···

On Wed, 16 Mar 2005 10:43:11 +0800, "Bruce Who" <HuXuZhao@hotmail.com> >wrote: