473,326 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Getting two scrollbars to mirror eachother

I have two large text boxes side by side which when loaded with text will
usually get a horizontal scrollbar automatically.

I would like to set it up so that when I scroll a bit to one direction on
one textbox, the other textbox scrolls in the same direction with the same
amount...

how to do this?
Nov 17 '05 #1
5 2144
Update, I had to change from TextBox to ListView now for column support, but
I still have the same problem- how can I get two ListView's scrollbars to
mirror eachother?

There aren't even any properties/methods on ListView to get at the
scrollbars...
Nov 17 '05 #2
MrNobody,

Basically, when you scroll one list view, you can send the LVM_SCROLL
message to the other to make that one scroll as well. You can detect when
one list view scrolls by overriding the WndProc method and looking for the
WM_VSCROLL (vertical scroll) message, I believe.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
I have two large text boxes side by side which when loaded with text will
usually get a horizontal scrollbar automatically.

I would like to set it up so that when I scroll a bit to one direction on
one textbox, the other textbox scrolls in the same direction with the same
amount...

how to do this?

Nov 17 '05 #3
Thanks for your reply!

Ok I know how to extend the control and override the WndProc method but how
do I compare the Msg property to 'WM_VSCROLL' ? When I do:

if (m.Msg == WM_VSCROLL)

I get a compiler error, it does not know what WM_VSCROLL is...

also, onced I capture this how do I send this as a command to the other
ListView's scrollbar?
Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:
MrNobody,

Basically, when you scroll one list view, you can send the LVM_SCROLL
message to the other to make that one scroll as well. You can detect when
one list view scrolls by overriding the WndProc method and looking for the
WM_VSCROLL (vertical scroll) message, I believe.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
I have two large text boxes side by side which when loaded with text will
usually get a horizontal scrollbar automatically.

I would like to set it up so that when I scroll a bit to one direction on
one textbox, the other textbox scrolls in the same direction with the same
amount...

how to do this?


Nov 17 '05 #4
MrNobody,

You can get the value for WM_VSCROLL from the C++ header file WinUser.h
(it should have been installed if you installed Visual C++, or you can
google it).

As for sending the message to the other listview, you can declare the
SendMessage function to be called through the P/Invoke layer (you can get
the definition from http://www.pinvoke.net).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
Thanks for your reply!

Ok I know how to extend the control and override the WndProc method but
how
do I compare the Msg property to 'WM_VSCROLL' ? When I do:

if (m.Msg == WM_VSCROLL)

I get a compiler error, it does not know what WM_VSCROLL is...

also, onced I capture this how do I send this as a command to the other
ListView's scrollbar?
Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:
MrNobody,

Basically, when you scroll one list view, you can send the LVM_SCROLL
message to the other to make that one scroll as well. You can detect
when
one list view scrolls by overriding the WndProc method and looking for
the
WM_VSCROLL (vertical scroll) message, I believe.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
>I have two large text boxes side by side which when loaded with text
>will
> usually get a horizontal scrollbar automatically.
>
> I would like to set it up so that when I scroll a bit to one direction
> on
> one textbox, the other textbox scrolls in the same direction with the
> same
> amount...
>
> how to do this?


Nov 17 '05 #5
Nicholas,

thanks again for your help!

OK this is starting to get a little bit over my head... (the sending message
part) What do you mean by declaring a SendMessage through a p/invoke layer? I
am totally unfamilar with what the web site is referencing...

"Nicholas Paldino [.NET/C# MVP]" wrote:
MrNobody,

You can get the value for WM_VSCROLL from the C++ header file WinUser.h
(it should have been installed if you installed Visual C++, or you can
google it).

As for sending the message to the other listview, you can declare the
SendMessage function to be called through the P/Invoke layer (you can get
the definition from http://www.pinvoke.net).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
6
by: adrien | last post by:
Hi, (also posted in netscape.public.mozilla.browser) i use netscape 7 and want to hide the scrollbars of the window when something happens. I tried this: window.scrollbars.visible=false...
24
by: Nobody | last post by:
Okay, you are all so smart in here. Answer me this: IE6 in standards mode doesn't seem to hide scrollbars on the body element (overflow:hide) Ain't this a quandary. I have it in my head that I...
18
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm =...
2
by: Daisy | last post by:
I've got a custom control that works fine, it's DockStyle is set to Fill for the panel it's in. I've just added a VScrollBar docked Right in the panel. It appears, and works fine, however in the...
3
by: Eduard Witteveen | last post by:
Hello list, I have code the draw MyDrawingObject information on a System.Drawing.Graphics object. The code is more/less the following: I now want to rotate / mirror the object i draw. I've...
3
by: dennijr | last post by:
does anyone know of a way to control a listboxes scollbar with annother scroll bar? what im trying to do is make it so that by using a scroll bar i create, i can scroll up and down on more than...
4
by: Mark A | last post by:
I would like to make a split mirror copy of a HADR standby database. Please note that I do not want to create a standby with a split mirror of the primary, but I want to make a split mirror of the...
1
by: DKn | last post by:
Hi, Is there any WMI class to get the Information related to Mirror drivers installed in the target system.The information like the mirror driver Name , installed date, the current status etc .....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.