1) I have 2 textctrls, one of which recieves data alot. I have another textctrl that I use as a scroll buffer. Basically, a user hits a specific key and this second control is shown. I would like to copy all data that is currently in the first control into the second control with all styles intact. Is there an easy way to do this?
2) How do you set how many lines a textctrl can have before older stuff starts falling out of it? Or is this even possible?
Thanks,
Eric
1) I have 2 textctrls, one of which recieves data alot. I have another
textctrl that I use as a scroll buffer. Basically, a user hits a
specific key and this second control is shown. I would like to copy all
data that is currently in the first control into the second control with
all styles intact. Is there an easy way to do this?
txt = tctrl1.GetRange(0, tctrl1.GetLastPosition())
tctrl2.AppendText(txt)
2) How do you set how many lines a textctrl can have before older stuff
starts falling out of it? Or is this even possible?
Nothing ever falls out of a TextCtrl. If you want to trim what has come
before, you have to do it "by hand". If you are running on Windows, be
careful of the default TextCtrl style/control, it stops accepting text
after 32k. I would suggest you pass wx.TE_RICH2 whenever possible.
For an example of how you can do that, download the source distribution
of PyPE (PyPE (Python Programmers Editor) download | SourceForge.net) and in file plugins/shell.py,
check the process.AppendText() method.
- Josiah
···
Eric Davis <endavis@gmail.com> wrote:
Sunday, December 11, 2005, 5:55:48 PM, Josiah Carlson wrote:
···
Eric Davis <endavis@gmail.com> wrote:
1) I have 2 textctrls, one of which recieves data alot. I have
another textctrl that I use as a scroll buffer. Basically, a user
hits a specific key and this second control is shown. I would like
to copy all data that is currently in the first control into the
second control with all styles intact. Is there an easy way to do
this?
txt = tctrl1.GetRange(0, tctrl1.GetLastPosition())
tctrl2.AppendText(txt)
Will this really keep all styles intact?
-- tacao
No bits were harmed during the making of this e-mail.
Nope, doesn't keep styles intact. I haven't figured out a way to do it yet.
Eric
E. A. Tacao wrote:
···
Sunday, December 11, 2005, 5:55:48 PM, Josiah Carlson wrote:
txt = tctrl1.GetRange(0, tctrl1.GetLastPosition())
tctrl2.AppendText(txt)
Will this really keep all styles intact?
-- tacao
No bits were harmed during the making of this e-mail.
Tuesday, December 13, 2005, 12:49:53 AM, Eric Davis wrote:
Nope, doesn't keep styles intact. I haven't figured out a way to do
it yet.
As the first text control receives styles, you'll have to store some
info (start pos, end pos, TextAttr, whatever) about them somewhere so
that you'll be able to format the 2nd control accordingly.
-- tacao
No bits were harmed during the making of this e-mail.