i have a TextCtrl with style=(TE_MULTILINE | TE_READONLY | TE_RICH) for outputting
error messages, warnings and other information. text is always appended in one of
several colours.
on macosx all is good but on win32, the automatic scrolling behaviour is annoying.
when the textctrl is visually full of text and a new message is being appended, by
default, the textctrl will scroll so far down that the newly appended text is above
the top of the textctrl and so is not visible to the user.
my approach to work around that default behaviour is so store the position of the end
of the existing text before appending the new text and then calling ShowPosition(pos+1)
after appending the new text to ensure that the first character of the new text is
always visible.
that's what i've been doing for ages and it does work but it's still not ideal because
when the call to ShowPosition() needs to scroll, the result will be that the first
character of the newly appended text will appear at the top of the textctrl. i'd prefer
it if it scrolled the minimum amount necessary to make the given position visible.
the reason that this matters is that several messages may be appended in rapid succession
and if the last message requires the textctrl to scroll then the earlier messages will not
be seen by the user.
is there anything i can do to make ShowPosition() on win32 only scroll by the minimum
amount necessary rather than the maximum amount possible?
Have you tried wx.TE_RICH2? IIRC they have slightly different behaviors in this area.
···
On 10/11/11 7:04 PM, raf wrote:
hi,
python-2.6, wxpython-2.8.12.1 (unicode)
i have a TextCtrl with style=(TE_MULTILINE | TE_READONLY | TE_RICH) for outputting
error messages, warnings and other information. text is always appended in one of
several colours.
on macosx all is good but on win32, the automatic scrolling behaviour is annoying.
when the textctrl is visually full of text and a new message is being appended, by
default, the textctrl will scroll so far down that the newly appended text is above
the top of the textctrl and so is not visible to the user.
my approach to work around that default behaviour is so store the position of the end
of the existing text before appending the new text and then calling ShowPosition(pos+1)
after appending the new text to ensure that the first character of the new text is
always visible.
that's what i've been doing for ages and it does work but it's still not ideal because
when the call to ShowPosition() needs to scroll, the result will be that the first
character of the newly appended text will appear at the top of the textctrl. i'd prefer
it if it scrolled the minimum amount necessary to make the given position visible.
the reason that this matters is that several messages may be appended in rapid succession
and if the last message requires the textctrl to scroll then the earlier messages will not
be seen by the user.
is there anything i can do to make ShowPosition() on win32 only scroll by the minimum
amount necessary rather than the maximum amount possible?
>hi,
>
>python-2.6, wxpython-2.8.12.1 (unicode)
>
>i have a TextCtrl with style=(TE_MULTILINE | TE_READONLY | TE_RICH) for outputting
>error messages, warnings and other information. text is always appended in one of
>several colours.
>
>on macosx all is good but on win32, the automatic scrolling behaviour is annoying.
>when the textctrl is visually full of text and a new message is being appended, by
>default, the textctrl will scroll so far down that the newly appended text is above
>the top of the textctrl and so is not visible to the user.
>
>my approach to work around that default behaviour is so store the position of the end
>of the existing text before appending the new text and then calling ShowPosition(pos+1)
>after appending the new text to ensure that the first character of the new text is
>always visible.
>
>that's what i've been doing for ages and it does work but it's still not ideal because
>when the call to ShowPosition() needs to scroll, the result will be that the first
>character of the newly appended text will appear at the top of the textctrl. i'd prefer
>it if it scrolled the minimum amount necessary to make the given position visible.
>
>the reason that this matters is that several messages may be appended in rapid succession
>and if the last message requires the textctrl to scroll then the earlier messages will not
>be seen by the user.
>
>is there anything i can do to make ShowPosition() on win32 only scroll by the minimum
>amount necessary rather than the maximum amount possible?
Have you tried wx.TE_RICH2? IIRC they have slightly different
behaviors in this area.
yes, i tried that but the behaviour appeared to be identical to me.