wx.TextCtrl - ShowPosition() - behaviour on Windows and Linux

Hi all,

while testing my script (written on windows XP) on linux (Kubuntu 8.04) I noticed some differences in the behaviour.

One thing that some functions are relying on is wx.TextCtrl - ShowPosition()

On windows after calling this method the given position is shown near the top of the text control (which is exactly, what I need, as this should be a synchronised display of multiple texts).

However in my tests on linux, this seems to be more complex - the texts is scrolled depending on the previous position, i.e. if first scrolled e.g. to the end, the position with a smaller index passed to ShowPosition() will be shown near the bottom of the control; there also won’t be any scroll-change, if the text is already in the visible area (maybe in the middle).

While I recognise, that both versions do, what the function name (and the documentation) says, I’d prefer the former one - is there any possibility to achieve this (scrolling the given text index to the top of the visible area) in TextCtrl crossplatform?

(I thought about calling ShowPosition(0) before the actual value, but I’m not sure, if this is an adequate solution (only the few line at the beginning wouldn’t work well with this).)

Are there maybe other possibilities?

Thank you very much,

BTW, I was really amazed, that almost everything worked well without any changes in the sourcecode, although I didn’t pay much attention to these aspects while writting; (there are mostly some visual glitches, that need finetuning anyway).

regards,

Vlasta

I suspect this is just a difference in how the native text controls on
the platforms differ. If you want to remove the flickering that can
be caused by ShowPosition(0), ShowPosition(actual_position), you can
.Freeze() before you do both calls, then .Thaw() .

- Josiah

···

On Thu, Jun 26, 2008 at 4:00 PM, Vlastimil Brom <vlastimil.brom@gmail.com> wrote:

Hi all,

while testing my script (written on windows XP) on linux (Kubuntu 8.04) I
noticed some differences in the behaviour.

One thing that some functions are relying on is wx.TextCtrl - ShowPosition()

On windows after calling this method the given position is shown near the
top of the text control (which is exactly, what I need, as this should be a
synchronised display of multiple texts).

However in my tests on linux, this seems to be more complex - the texts is
scrolled depending on the previous position, i.e. if first scrolled e.g. to
the end, the position with a smaller index passed to ShowPosition() will be
shown near the bottom of the control; there also won't be any scroll-change,
if the text is already in the visible area (maybe in the middle).

While I recognise, that both versions do, what the function name (and the
documentation) says, I'd prefer the former one - is there any possibility to
achieve this (scrolling the given text index to the top of the visible area)
in TextCtrl crossplatform?

(I thought about calling ShowPosition(0) before the actual value, but I'm
not sure, if this is an adequate solution (only the few line at the
beginning wouldn't work well with this).)

Are there maybe other possibilities?

Thank you very much,

BTW, I was really amazed, that almost everything worked well without any
changes in the sourcecode, although I didn't pay much attention to these
aspects while writting; (there are mostly some visual glitches, that need
finetuning anyway).

Thanks for the hint Josiah, I forgot about these functions; this might solve the the visual problem for most cases.

(I still don’t know (for the Linux version of my script), how to scroll e.g. the line 10 to the top of the text control, if currently the lines 1-20 are shown, but that’s another story …) (I really wouldn’t want to add extra 30 empty lines at the beginning of each text just because of this … :slight_smile:

thanks again!

Vlasta

···

2008/7/2, Josiah Carlson josiah.carlson@gmail.com:

On Thu, Jun 26, 2008 at 4:00 PM, Vlastimil Brom > vlastimil.brom@gmail.com wrote:

Hi all,

while testing my script (written on windows XP) on linux (Kubuntu 8.04) I

noticed some differences in the behaviour.

One thing that some functions are relying on is wx.TextCtrl - ShowPosition()

(I thought about calling ShowPosition(0) before the actual value, but I’m

not sure, if this is an adequate solution (only the few line at the
beginning wouldn’t work well with this).)

I suspect this is just a difference in how the native text controls on

the platforms differ. If you want to remove the flickering that can
be caused by ShowPosition(0), ShowPosition(actual_position), you can
.Freeze() before you do both calls, then .Thaw() .

  • Josiah

wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users