[wxPython] wxTextCtrl suggestion ScrollEnd()

I'm doing the classic chat-window layout, a scrolling "log" of the chat,
with a seperate entry box below for adding new text...

···

________________

             >
             >
             >

________________
________________

I'm using two text controls, one a read-only multi-line (the log), one a
regular single-line control. I take the data from the second, push it
across the multi-user interfaces, then dump it into the multi-line window.
Since I want the multi-line window to scroll, I'd like to call
text.ShowPosition( text.GetLastPosition()), unfortunately, that gives you
the position scrolled to the _top_ of the window (i.e. you only see the last
line of the log).

Currently I'm doing some ugly hackery to display the last three lines if the
lines are under a certain length (I count the characters back, subtract from
getlastpos and use that as the ShowPosition() argument). Since the frame is
dynamically sized, however, I'm often either wasting a few lines or (worse),
not actually showing the last line.

I could ask for something like "GetHeightAsLines()" and then figure out
whether line-breaks are being added due to the width of the log window, but
it would be much easier to have (and I'm lazy enough to suggest) something
that says:

if numLines < window.Height:
  scrollSo0PositionIsAtTopOfControl()
else:
  scrollSoLastPositionIsAtBottomOfControl()

No idea how hard that would be to implement... for that matter, maybe I
should use something like Scintilla instead (does Scintilla support
line-wrapping?) if that has this kind of support.

Enjoy,
Mike

__________________________________
Mike C. Fletcher
Designer, VR Plumber
http://members.home.com/mcfletch
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

the

If all you're doing is adding text to the end then
textctrl.AppendText("text") will keep the end of the text visible.

···

----- Original Message -----
From: "Mike Fletcher" <mfletch@tpresence.com>
To: "'wxPython Users (E-mail) '" <wxpython-users@lists.sourceforge.net>
Sent: Thursday, October 19, 2000 11:54 AM
Subject: [wxPython] wxTextCtrl suggestion ScrollEnd()

I'm doing the classic chat-window layout, a scrolling "log" of the chat,
with a seperate entry box below for adding new text...

Currently I'm doing some ugly hackery to display the last three lines if

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxPython.org Java give you jitters?
http://wxPROs.com Relax with wxPython!

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users