943,690 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1066
  • C++ RSS
May 11th, 2008
0

ScrollBar on Form

Expand Post »
I have a Form witch scrollbars that is called Form2.
Is there any way to programatically go to the top of the Form without having to scrollup with the mouse ?
So if you have scrolled down to the end of the form. Is it possible to press a button that consist code that will go to the top of the Form2 ?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Posting Pro
Jennifer84 is offline Offline
563 posts
since Feb 2008
May 11th, 2008
0

Re: ScrollBar on Form

Yep.

You can set the form's ClientOrigin property (which is a tPoint)

or

You can set the position property of the form's HorzScrollBar and/or VertScrollBar.

Have fun!
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
May 12th, 2008
0

Re: ScrollBar on Form

I am trying to use this code to programatically scroll the Form2 to the top but this does not work. I think I missing something ?

C++ Syntax (Toggle Plain Text)
  1. Form2::VerticalScroll->Maximum;


Click to Expand / Collapse  Quote originally posted by Duoas ...
Yep.

You can set the form's ClientOrigin property (which is a tPoint)

or

You can set the position property of the form's HorzScrollBar and/or VertScrollBar.

Have fun!
Last edited by Jennifer84; May 12th, 2008 at 10:11 am.
Reputation Points: 10
Solved Threads: 1
Posting Pro
Jennifer84 is offline Offline
563 posts
since Feb 2008
May 12th, 2008
0

Re: ScrollBar on Form

Quote ...
I think I missing something ?
Yes, you are missing all the words I put in bold in my first response.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
May 12th, 2008
0

Re: ScrollBar on Form

I am not sure if I understand.
If I write Form2::VerticalScroll I cant find ClientOrigin or position as members.

I can“t find position or ClientOrigin as member to Form2:: either, so I think I am a bit stuck.

Click to Expand / Collapse  Quote originally posted by Duoas ...
Yes, you are missing all the words I put in bold in my first response.
Reputation Points: 10
Solved Threads: 1
Posting Pro
Jennifer84 is offline Offline
563 posts
since Feb 2008
May 12th, 2008
0

Re: ScrollBar on Form

> I am not sure if I understand.
Ed was afraid that might happen. Duoas isn't describing Windows Forms, so his suggestions won't work for you. The code you want is Form2::VerticalScroll->Value = 0; , but if Ed remembers correctly, that won't work as well as you probably want with the autoscrolling properties of a form.
Last edited by Radical Edward; May 12th, 2008 at 4:00 pm.
Reputation Points: 361
Solved Threads: 97
Posting Pro
Radical Edward is offline Offline
526 posts
since May 2008
May 12th, 2008
0

Re: ScrollBar on Form

Ed is close. Jennifer is using C++Builder.

You can set
Form2::VertScrollBar->Position = 0;

My apologies on ClientOrigin. I just looked it up and it is a read-only property. Alas.

Keep in mind my capitalization might be a little off.

I admire your tenacity and efforts, but either your documentation really stinks or you still need to work on searching it. (I just got BDS 2006 and it's documentation really stinks.)

Hope this helps.
Last edited by Duoas; May 12th, 2008 at 7:25 pm.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
May 12th, 2008
0

Re: ScrollBar on Form

No problem. I am using this code now and it seems to work fine for this purpose.
Thank you...

C++ Syntax (Toggle Plain Text)
  1. Form2::VerticalScroll->Value = 0;

Click to Expand / Collapse  Quote originally posted by Duoas ...
Ed is close. Jennifer is using C++Builder.

You can set
Form2::VertScrollBar->Position = 0;

My apologies on ClientOrigin. I just looked it up and it is a read-only property. Alas.

Keep in mind my capitalization might be a little off.

I admire your tenacity and efforts, but either your documentation really stinks or you still need to work on searching it. (I just got BDS 2006 and it's documentation really stinks.)

Hope this helps.
Reputation Points: 10
Solved Threads: 1
Posting Pro
Jennifer84 is offline Offline
563 posts
since Feb 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Reversing a linked list using Recursion
Next Thread in C++ Forum Timeline: this->form2instance.Show();





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC