Quantcast

[wxPython] How do I make two stylesTextCtrl scroll in sync?

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

[wxPython] How do I make two stylesTextCtrl scroll in sync?

Barry Scott-3
I have two wxStyledTextCtrl in a splitter. I need the two controls to track
so that when the one window is scrolled I can scroll the other. The user
will see that both windows show the same lines and that the column offset
is the same.

I think I need to catch key events on each window and play them into the
other. I started by trying to get the scroll events with EVT_SCROLLWIN.
An event.skip() has the first window moving its view port. But I cannot
find a method to call to move the second window to match.

The application here is a visual diff like the one built into
Visual SourceSafe. But I'm using Tim Peter's ndiff as the difference
engine.

                BArry






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

Re: [wxPython] How do I make two stylesTextCtrl scroll in sync?

Robin Dunn
> I have two wxStyledTextCtrl in a splitter. I need the two controls to
track
> so that when the one window is scrolled I can scroll the other. The user
> will see that both windows show the same lines and that the column offset
> is the same.

You can use GetFirstVisibleLine in one window and ScrollToLine in the other.

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







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

RE: [wxPython] How do I make two stylesTextCtrl scroll in sync?

Barry Scott-3
I have the lines sync'ed up now. I had to use the trick of AddPendingEvent
of a custom event to make sure that the scroll event was processed
completely
before I called GetFirstVisibleLine().

Was I right in thinking that there no GetFirstVisibleColumn()?

                BArry

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]On Behalf Of Robin Dunn
Sent: 13 May 2002 19:58
To: [hidden email]
Subject: Re: [wxPython] How do I make two stylesTextCtrl scroll in sync?


> I have two wxStyledTextCtrl in a splitter. I need the two controls to
track
> so that when the one window is scrolled I can scroll the other. The user
> will see that both windows show the same lines and that the column offset
> is the same.

You can use GetFirstVisibleLine in one window and ScrollToLine in the other.

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




_______________________________________________
wxpython-users mailing list
[hidden email]
http://lists.wxwindows.org/mailman/listinfo/wxpython-users






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

Re: [wxPython] How do I make two stylesTextCtrl scroll in sync?

Robin Dunn
> I have the lines sync'ed up now. I had to use the trick of AddPendingEvent
> of a custom event to make sure that the scroll event was processed
> completely
> before I called GetFirstVisibleLine().

Makes sense.

>
> Was I right in thinking that there no GetFirstVisibleColumn()?

Horizontal scrolling is in pixels since different styles and/or proportional
fonts make it so there is no such thing as a "column" that makse sense for
each line.  There are GetXOffset and SetXOffset methods though.

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







Loading...