wx.TextCtrl and text focus

I am using a TextCtrl to use as a log viewer in my application. When I am adding a single/multiple line text, the text is not visible because of scrolling two lines upwards. I have to manually adjust the scrollbar to view it. Here I am sure that I am not adding any spaces or empty line in the end of my text. How do I keep focus on the text that has been entered ?

The style that has been used for creating TextCtrl:

style = (wx.TE_MULTILINE | wx.TE_READONLY | wx.SUNKEN_BORDER | wx.TE_RICH2)

Prashant

···

Add more friends to your messenger and enjoy! Invite them now.

Prashant Saxena wrote:

I am using a TextCtrl to use as a log viewer in my application. When I am adding a single/multiple line text, the text is not visible because of scrolling two lines upwards. I have to manually adjust the scrollbar to view it. Here I am sure that I am not adding any spaces or empty line in the end of my text. How do I keep focus on the text that has been entered ?

The style that has been used for creating TextCtrl:

style = (wx.TE_MULTILINE | wx.TE_READONLY | wx.SUNKEN_BORDER | wx.TE_RICH2)

It's hard to get the various native text widgets on the various platforms to work as desired in situations like this, because they each have their little quirks and behavioral differences. (One of these days I should just create a generic widget that is designed for displaying log messages and nothing else...) Anyway, I would experiment with using wx.TE_RICH (instead of RICH2), calling ShowPosition passing the position of the line a few lines above the last, etc. until you get what you want.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!