Quantcast

Synchronized scrolling of multiple Textctrl widgets

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Synchronized scrolling of multiple Textctrl widgets

Tony Cappellini-2
My application is using two identically-sized textctrl widgets.
I want to synchronize both horizontal and vertical scrolling in 2
textctrl Widgets if this is possible.

That is, when the user scrolls on either scrollbar on the left widget,
the widget on the right will scroll by the same amount.

Looking at the message watcher, I don't see any messages displayed
when I scroll on the vertical or horizontal scrollbar.

I would also like to synchronize the selecting (highlighting) of any
line, between the two textctrl  widgets.
That is, when the user selects a line on the left widget, the line in
the same position (index) in the right widget
will be displayed at the same position (index) and highlighted as well.

At the moment, I have to double click on the text 3 times in the
textctrl widgets, before the entire line is highlighted. This is very
undesirable.

Does anyone have some suggestions how I can do this?

thanks


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Synchronized scrolling of multiple Textctrl widgets

Chris Mellon
On Dec 5, 2007 5:12 PM, Tony Cappellini <[hidden email]> wrote:

> My application is using two identically-sized textctrl widgets.
> I want to synchronize both horizontal and vertical scrolling in 2
> textctrl Widgets if this is possible.
>
> That is, when the user scrolls on either scrollbar on the left widget,
> the widget on the right will scroll by the same amount.
>
> Looking at the message watcher, I don't see any messages displayed
> when I scroll on the vertical or horizontal scrollbar.
>
> I would also like to synchronize the selecting (highlighting) of any
> line, between the two textctrl  widgets.
> That is, when the user selects a line on the left widget, the line in
> the same position (index) in the right widget
> will be displayed at the same position (index) and highlighted as well.
>
> At the moment, I have to double click on the text 3 times in the
> textctrl widgets, before the entire line is highlighted. This is very
> undesirable.
>
> Does anyone have some suggestions how I can do this?
This can be a little trickier than you think. I've never tried it with
wxTextCtrl, but I did it using subclasses of wxStyledTextCtrl for a
hex editor I've written. It doesn't sync selection by line - it uses
the offset into the raw bytestream instead - but you should be able to
adapt it.

I'll attach the module.

hex.py (9K) Download Attachment
Loading...