Abnormal Behaviour of Vertical ScrollBar

Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: May 2004
Posts: 6
Reputation: Amir Ali is an unknown quantity at this point 
Solved Threads: 0
Amir Ali Amir Ali is offline Offline
Newbie Poster

Abnormal Behaviour of Vertical ScrollBar

 
1
  #1
May 21st, 2004
Dear All,
In VB.net,
(1) Place a textbox on the form with bigger size and multiline property TRUE
(2) Allow AutoScroll of the form TRUE
(3) Run the application
(4) Resize the form in such a way that there should be vertical scrollBar along the form
(5) Now click on the textbox

Imazingly, Some area of textbox has been selected.
Why?
How should it be controlled?

Please response soon.

Thanks.

Regards,
Amir Ali.
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Abnormal Behaviour of Vertical ScrollBar

 
1
  #2
May 22nd, 2004
Not sure I follow what you are saying. I did try it. By default the text (as the name of the textbox, in my case TextBox1) is automatically selected on startup. Why? That is because the control has focus.

If that is not what you want, then set the focus to another control on startup. In this case there is nothing else except the form itself.

Not sure if this helps, but maybe you could explain a little more by what you see as the problem with this?
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 6
Reputation: Amir Ali is an unknown quantity at this point 
Solved Threads: 0
Amir Ali Amir Ali is offline Offline
Newbie Poster

Re: Abnormal Behaviour of Vertical ScrollBar

 
0
  #3
May 24th, 2004
Dear Paladine,
Thanks for your response. I again try my best to make you clear about my problem.
Actually, when there would be vertical scrollbar along the form and position of scroll is most up. In this condition when we Click on RichTextBox, form will be scroll down. Thats why some area of RichTextbox is selected automatically. Position of form should not be changed by interacting with controls but it happens.

If you still not understand, then please just guide me how can I come to know that Windows scroll event is triggered and how I can prevent Form from being scrolled.

Many many Thanks.

Waiting for your reply,
Amir Ali.
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Abnormal Behaviour of Vertical ScrollBar

 
0
  #4
May 24th, 2004
Originally Posted by Amir Ali
Dear Paladine,
Thanks for your response. I again try my best to make you clear about my problem.
Actually, when there would be vertical scrollbar along the form and position of scroll is most up. In this condition when we Click on RichTextBox, form will be scroll down. Thats why some area of RichTextbox is selected automatically. Position of form should not be changed by interacting with controls but it happens.

If you still not understand, then please just guide me how can I come to know that Windows scroll event is triggered and how I can prevent Form from being scrolled.

Many many Thanks.

Waiting for your reply,
Amir Ali.
Ok Amir, from the description you have given, I am sorry to say I do not see the issue. I resize the form and the scroll bar appears. The Textbox is now partially covered, and I can use the scroll bar to see the non-visible portion. Clicking on the textbox does nothing but place the cursor in the textbox.

So I am not sure what the issue is? This is what should happen.

Position of form should not be changed by interacting with controls but it happens.
This does not happen for me? Interacting with the control does not change the window position. But saying that, if you have another control (even another textbox) on this form and press the tab key the focus does go to the next control and the viewable portion of the resized form does change to the new control. Problem? Nope, that is a fact of life. Not a problem. This is how windows works. Otherwise you could type or select a not in view an have no Idea where you cursor was, or if you have selected the control you want.

So a way around it? Not that I know of or see a reason to have one.

The only thing I could suggest is prevent resizing of the form.

Hope this helps, but if I am still not getting it...please clarify.


Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 6
Reputation: Amir Ali is an unknown quantity at this point 
Solved Threads: 0
Amir Ali Amir Ali is offline Offline
Newbie Poster

Re: Abnormal Behaviour of Vertical ScrollBar

 
0
  #5
May 24th, 2004
Thats good you followed to some extent.

Now please give some more attention.

You resized the form and there is scrollbar. Now scroll should be must up. Means its vertical position value should be 0. And textbox should be large enough that we may see at least five lines at a time. Now click on textbox. Text will be selected even you are not likely to do that.

Thanks for your patience.
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Abnormal Behaviour of Vertical ScrollBar

 
0
  #6
May 24th, 2004
Amir I am paying attention, the text is not selected as you suggest. When the program/form is first started it is, but that is by default. As I mentioned before this is the result of the set focus method. Focus is set to the only control on the form by default.

I do exactly as you state, but my result is not what you say it should be.

Sorry dude, maybe someone else can make sense of this, but I see no issue what so ever.
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 6
Reputation: Amir Ali is an unknown quantity at this point 
Solved Threads: 0
Amir Ali Amir Ali is offline Offline
Newbie Poster

Re: Abnormal Behaviour of Vertical ScrollBar

 
0
  #7
May 25th, 2004
OK, no problem. Please do not mind. I could not describe my problem in a right way. Anyhow

Please just guide me how I come to know that when form's vertical scroll's position is changed (By coding or by user interaction) and how can i prevent it from scrolling.

Thanks for your patience.

Amir Ali.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 1
Reputation: eirikree is an unknown quantity at this point 
Solved Threads: 0
eirikree eirikree is offline Offline
Newbie Poster

Re: Abnormal Behaviour of Vertical ScrollBar

 
0
  #8
May 21st, 2007
Did you ever find a solution to this problem? I am currently having the exact same problem you were trying to describe, and I can't figure out how to prevent the control from scrolling so that the textbox is aligned at the top of the window.

If you, or anyone else could help me out that would be greatly appreciated.

To try and describe the problem again as understandably as I can:
- I have a textBox (in fact it is a custom HtmlEditor that inherits from WebBrowser, but from this thread it seems the same thing can happen with a RichTextBox) that is larger than the control hosting it.
- I scroll so that an area in the middle of the textbox is visible.
- When I click in the textbox, the control automatically scrolls so that the top of the textbox is just visible.
- This scrolling seems to happen on mouseDown, because the result is the same as if i press the mouse button, scroll, and release the mouse button, so that lines of text are selected.

Eirik Ree
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 812
Reputation: arjunsasidharan is on a distinguished road 
Solved Threads: 13
arjunsasidharan's Avatar
arjunsasidharan arjunsasidharan is offline Offline
Practically a Posting Shark

Re: Abnormal Behaviour of Vertical ScrollBar

 
0
  #9
May 22nd, 2007
why don't you guys set focus points on the particular textbox or richtextbox you nead.

textbox1.focus()
There is just two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1
Reputation: Polama is an unknown quantity at this point 
Solved Threads: 0
Polama Polama is offline Offline
Newbie Poster

Re: Abnormal Behaviour of Vertical ScrollBar

 
0
  #10
Jun 25th, 2007
Hello. I too ran into this problem. It occurs when a control obtains focus. It calls ScrollControlIntoView on its parent which moves the autoscroll position so the entire control can be shown. Since my issue was occuring in a panel, I just created a new class NoAutoScrollPanel, and inherited from Panel. I then added the following code:

  1. protected override Point ScrollToControl(System.Windows.Forms.Control activeControl)
  2. {
  3. return this.AutoScrollPosition;
  4. }

ScrollToControl gives the position ScrollControlIntoView shoulds scroll to. This overriden version returns the current position. Now when you click a control the window won't scroll and no text will get selected.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC