TextCtrl, appendtext sometimes doesn't show everything ?

hello,

When dumping a lot of text to a multiline wx.TextCtrl, with the AppendText function,
sometimes not everything is shown.

Windows XP, SP2, Python 2.5.2, wxPython '2.8.7.1 (msw-unicode)'

Here an example
        -8.00000000e-02, -4.00000000e-02, 1.11022302e-15,
         4.00000000e-02, 8.00000000e-02, 1.20000000e-01,
         1.60000000e-01, 2.00000000e-01, 2.40000000e-01,
         2.800

Before the Appendtext, I've put a print statement, which shows everything all the time

I tried several extra actions after the AppendText but it doesn't help
    Log.AppendText ( text )
    Log.AppendText ( '\n' )
    Log.Refresh ()
    Log.TransferDataToWindow()

Even stranger, when the TextCtrl becomes more full ( more than 1500 lines),
the data is always displayed correct.

Any suggestions ?

thanks,
Stef

Stef Mientki wrote:

hello,

When dumping a lot of text to a multiline wx.TextCtrl, with the AppendText function,
sometimes not everything is shown.

Windows XP, SP2, Python 2.5.2, wxPython '2.8.7.1 (msw-unicode)'

Here an example
        -8.00000000e-02, -4.00000000e-02, 1.11022302e-15,
         4.00000000e-02, 8.00000000e-02, 1.20000000e-01,
         1.60000000e-01, 2.00000000e-01, 2.40000000e-01,
         2.800

Before the Appendtext, I've put a print statement, which shows everything all the time

I tried several extra actions after the AppendText but it doesn't help
    Log.AppendText ( text )
    Log.AppendText ( '\n' )
    Log.Refresh ()
    Log.TransferDataToWindow()

Even stranger, when the TextCtrl becomes more full ( more than 1500 lines),
the data is always displayed correct.

Any suggestions ?

Is the new text in the string returned from GetValue()? Does it make any difference if you add or remove wx.TE_RICH[2] style flags?

···

--
Robin Dunn
Software Craftsman

Robin Dunn wrote:

Stef Mientki wrote:
  

hello,

When dumping a lot of text to a multiline wx.TextCtrl, with the AppendText function,
sometimes not everything is shown.

Windows XP, SP2, Python 2.5.2, wxPython '2.8.7.1 (msw-unicode)'

Here an example
        -8.00000000e-02, -4.00000000e-02, 1.11022302e-15,
         4.00000000e-02, 8.00000000e-02, 1.20000000e-01,
         1.60000000e-01, 2.00000000e-01, 2.40000000e-01,
         2.800

Before the Appendtext, I've put a print statement, which shows everything all the time

I tried several extra actions after the AppendText but it doesn't help
    Log.AppendText ( text )
    Log.AppendText ( '\n' )
    Log.Refresh ()
    Log.TransferDataToWindow()

Even stranger, when the TextCtrl becomes more full ( more than 1500 lines),
the data is always displayed correct.

Any suggestions ?
    
Is the new text in the string returned from GetValue()?

GetValue also returns just a part of the data.

Does it make any difference if you add or remove wx.TE_RICH[2] style flags?
  

Both TE_RICH and TE_RICH2, show all the data,
but there's one small annoyance: with large datasets, the window is scrolled to so far up, that only the last line is visible.
Touching the scrollbar with the mouse, corrects the case.
Is there some method I could call to correct that ?
(Log.Refresh() doesn't help)

thanks,
Stef Mientki

···

Stef Mientki wrote:

Both TE_RICH and TE_RICH2, show all the data,
but there's one small annoyance: with large datasets, the window is scrolled to so far up, that only the last line is visible.
Touching the scrollbar with the mouse, corrects the case.
Is there some method I could call to correct that ?

Nothing I've tried makes it just magically work as expected, but a couple workarounds I've done are to (a) set the insertion point to be a few lines above the end, and then set the insertion point to the end again, or (b) instead of using AppendText do something like:

  value = Log.GetValue() + text
  Log.SetValue(value)
  Log.SetInsertionPointEnd()

···

--
Robin Dunn
Software Craftsman

Hi Stef,
I guess, you may try to use ShowPosition(...), however, you would have
to compute the top visible line somehow, if you want to fill the whole
text control.

There was a similar thread:

http://groups.google.com/group/wxPython-users/browse_thread/thread/316bfc7d272c65be/2ade8fafa8795406?lnk=raot

(it seems, that it some cases the text isn't shown at all after
AppendText(...) in the richtext variants of TextCtrl.

greetings,
   Vlasta

···

2009/8/21 Stef Mientki <stef.mientki@gmail.com>:

Robin Dunn wrote:

Stef Mientki wrote:

hello,

When dumping a lot of text to a multiline wx.TextCtrl, with the
AppendText function,
sometimes not everything is shown.

Windows XP, SP2, Python 2.5.2, wxPython '2.8.7.1 (msw-unicode)'

Here an example
-8.00000000e-02, -4.00000000e-02, 1.11022302e-15,
4.00000000e-02, 8.00000000e-02, 1.20000000e-01,
1.60000000e-01, 2.00000000e-01, 2.40000000e-01,
2.800

Before the Appendtext, I've put a print statement, which shows
everything all the time

I tried several extra actions after the AppendText but it doesn't help
Log.AppendText ( text )
Log.AppendText ( '\n' )
Log.Refresh ()
Log.TransferDataToWindow()

Even stranger, when the TextCtrl becomes more full ( more than 1500 lines),
the data is always displayed correct.

Any suggestions ?

Is the new text in the string returned from GetValue()?

GetValue also returns just a part of the data.

Does it make
any difference if you add or remove wx.TE_RICH[2] style flags?

Both TE_RICH and TE_RICH2, show all the data,
but there's one small annoyance: with large datasets, the window is
scrolled to so far up, that only the last line is visible.
Touching the scrollbar with the mouse, corrects the case.
Is there some method I could call to correct that ?
(Log.Refresh() doesn't help)

thanks,
Stef Mientki

>

Robin Dunn wrote:

Stef Mientki wrote:

Both TE_RICH and TE_RICH2, show all the data,
but there's one small annoyance: with large datasets, the window is scrolled to so far up, that only the last line is visible.
Touching the scrollbar with the mouse, corrects the case.
Is there some method I could call to correct that ?
    
Nothing I've tried makes it just magically work as expected, but a couple workarounds I've done are to (a) set the insertion point to be a few lines above the end, and then set the insertion point to the end again, or (b) instead of using AppendText do something like:

  value = Log.GetValue() + text
  Log.SetValue(value)
  Log.SetInsertionPointEnd()

thanks Robin,

finally I got it working, (although some flicker)
<== NO, means doesn't work
<== YES, means it works

    Log.AppendText ( text )
    Log.SetInsertionPoint ( GetLastPosition() - 500 ) <== NO
    Log.SetInsertionPoint ( len ( Log.GetValue ()) - 10 ) <== NO
    Log.SetInsertionPoint (0) <== YES
    Log.SetInsertionPointEnd ()

There seems to be a similar bug in the PageDown key:
when using the scrollbar, you can't pass the end of the text, which is correct.
Pressing the PageDown Key scrolls (depending on the startposition) beyond the end of the text.

cheers,
Stef

Hi Stef,
I guess, you may try to use ShowPosition(...), however, you would have
to compute the top visible line somehow, if you want to fill the whole
text control.

There was a similar thread:

http://groups.google.com/group/wxPython-users/browse_thread/thread/316bfc7d272c65be/2ade8fafa8795406?lnk=raot

(it seems, that it some cases the text isn't shown at all after
AppendText(...) in the richtext variants of TextCtrl.

Thanks Vlasta,
the suggestions in this thread didn't work for me,
but it works now,
see the reply on the suggestion of Robin.

cheers,
Stef