473,785 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stop a RichTextBox control from scrolling when it has focus

Hi,

When a RichTextBox control doesn't have focus, it DOES NOT scroll to the
last line that is added; however, if it does have focus, it WILL scroll to
the last line added. I want to stop and start this behavior at will. When
I stop the behavior, this will give users a chance to examine the text that
is at the top of the document while new text is being added at the bottom.

I have tried inheriting from the RichTextBox control and overriding the
WndProc method to capture incoming WM_VSCROLL messages, but that doesn't
seem to be what is controlling the scroll action. I have placed Trace
statements in the WndProc method to look for the message in question, but I
can't seem to find it. I am beginning to believe that this is the wrong
way to go about solving this problem, so I decided to post to the group and
see if anybody has done or knows how to do this.

By the way, does anybody know where I can find a complete list of windows
messages (e.g. WM_VSCROLL) with their associated numeric values. I have
tried searching the documentation at Microsoft's web site, but it's like
trying to find a needle in a haystack. You would think that you could find
a list in the "See Also" links at the bottom of the SendMessage and
PostMessage methods or at least by looking up a known message name like
WM_VSCROLL, but that would be too easy.

Thanks,
Dave
Jan 5 '06 #1
4 3624
You can get the message values from the header files installed with VC.

D. Yates wrote:
Hi,

When a RichTextBox control doesn't have focus, it DOES NOT scroll to the
last line that is added; however, if it does have focus, it WILL scroll to
the last line added. I want to stop and start this behavior at will. When
I stop the behavior, this will give users a chance to examine the text that
is at the top of the document while new text is being added at the bottom.

I have tried inheriting from the RichTextBox control and overriding the
WndProc method to capture incoming WM_VSCROLL messages, but that doesn't
seem to be what is controlling the scroll action. I have placed Trace
statements in the WndProc method to look for the message in question, but I
can't seem to find it. I am beginning to believe that this is the wrong
way to go about solving this problem, so I decided to post to the group and
see if anybody has done or knows how to do this.

By the way, does anybody know where I can find a complete list of windows
messages (e.g. WM_VSCROLL) with their associated numeric values. I have
tried searching the documentation at Microsoft's web site, but it's like
trying to find a needle in a haystack. You would think that you could find
a list in the "See Also" links at the bottom of the SendMessage and
PostMessage methods or at least by looking up a known message name like
WM_VSCROLL, but that would be too easy.

Thanks,
Dave

Jan 5 '06 #2
someone just posted this link as well for a question I had asked and the
website has EVERYTHING as far as message values etc go:

www.pinvoke.net

Benny Raymond wrote:
You can get the message values from the header files installed with VC.

D. Yates wrote:
Hi,

When a RichTextBox control doesn't have focus, it DOES NOT scroll to
the last line that is added; however, if it does have focus, it WILL
scroll to the last line added. I want to stop and start this behavior
at will. When I stop the behavior, this will give users a chance to
examine the text that is at the top of the document while new text is
being added at the bottom.

I have tried inheriting from the RichTextBox control and overriding
the WndProc method to capture incoming WM_VSCROLL messages, but that
doesn't seem to be what is controlling the scroll action. I have
placed Trace statements in the WndProc method to look for the message
in question, but I can't seem to find it. I am beginning to believe
that this is the wrong way to go about solving this problem, so I
decided to post to the group and see if anybody has done or knows how
to do this.

By the way, does anybody know where I can find a complete list of
windows messages (e.g. WM_VSCROLL) with their associated numeric
values. I have tried searching the documentation at Microsoft's web
site, but it's like trying to find a needle in a haystack. You would
think that you could find a list in the "See Also" links at the bottom
of the SendMessage and PostMessage methods or at least by looking up a
known message name like WM_VSCROLL, but that would be too easy.

Thanks,
Dave

Jan 5 '06 #3
Thanks Benny.
Jan 6 '06 #4
I think I posted this to the wrong group.....

I will try posting this to
microsoft.publi c.dotnet.framew ork.windowsform s.controls
Dave
Jan 6 '06 #5

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

Similar topics

6
29231
by: Rachel Suddeth | last post by:
I have the index of a line in the Lines array of a RichTextBox. I would like to have it scroll so that line displays at the top. Is there no way to do this? The only way I can see to make it scroll is with ScrollToCaret(). But I don't know how to set the "caret" to a particular line. Any suggestions? -Rachel
8
15431
by: Grant Schenck | last post by:
I have code where I append text to a rich text box. I grab the current SelectionStart and SelectionLength before I append the text and then after I reset the SelectionStart and SelectionLength to their former values. I then do a ScrollToCaret() to insure that the selection still shows on the screen (because the append text moves it.) Now, it all works but I get a noticible flash as I append the text and apparently the control updates....
0
1136
by: Jean-Francois Lord | last post by:
Hello, I have a multithreaded windows app that has a RichTextBox acting as an output console for the worker threads. I need a way of scrolling down to the bottom of the RichTextBox as text is added without stealing the focus from my other controls. RichTextBox.Focus() RichTextBox.ScrollToCarret()
2
17384
by: JonnyT | last post by:
I searched high and low for an answer on how to auto scroll a richtextbox and now I finally have it. Since it took me a while to get a good efficient way of doing it that didn't require focus to the control or the scrolltocaret method I decided that it would be worth posting to anyone who might have similar concerns. For the record this works well in an environment where you cannot have focus going to the richtextbox....such as a chat...
7
2066
by: Richard | last post by:
When you give focus to a RichTextBox, then it goes to the textCursor, but i don't want to give the richtextbox focus, cause there is being written a lot in it, and I have to do something else at the same time, then if I don't give it focus, and I add some text to it, then it don't automaticly scrolls down to the textcursor, is there a way to make the RichTextBox scroll down to the textcursor, without giving it focus?? Richard
1
5582
by: Daniel Friend | last post by:
How do I scroll to the bottom of RichTextBox Currently tried RichTextBox1.SelectionStart=len(RichTextBox1.text) RichTextBox1.ScrollToCaret This does not work. What is the best what to accomplish this
3
2719
by: Brian Tkatch | last post by:
I have a form with two DataGrids, which are kept in sync manually via Stored PROCEDURE calls. That is, when a record is selected on the first grid, a stored PROCEDURE is CALLed to Fill() the next second DataGrid's DataSource. All that works very well. And, when there are no records to display, it is simply left blank. My issue is that when i scroll the first one, sometimes the second grid shows a bunch of null values (a "new" record). ...
6
2003
by: DrifterKona | last post by:
I have a form with 4 pages. I'm not sure of the correct name, but I will refer to the tabs at the top of the form that list the names of the four pages as the "page tabs". When the form opens, the body of the form automatically scrolls down to the first tab stop on the form. This causes the body of the form to scroll down so far that the page tabs are no longer viewable. That is undesirable for two reasons. First, if a user wants to...
1
2901
by: dotnetnoob | last post by:
i have a Dialog form with richtextbox that basically display a legal agreement and when the user drag the scroll thumb down to the end of scrolling which suppose to mean the user have read it then the checkbox is enabled for the user to tick off (I agree) and the next button is enabled for user to click next. the richtextbox vscroll event only fire when user click on the scrollthumb and that's it. how do i implement it when user drag the...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.