User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 361,561 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,022 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 270 | Replies: 7 | Solved
Reply
Join Date: Feb 2008
Posts: 404
Reputation: Jennifer84 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Jennifer84 Jennifer84 is offline Offline
Posting Pro in Training

ScrollBar on Form

  #1  
May 11th, 2008
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 ?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,687
Reputation: Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all 
Rep Power: 9
Solved Threads: 160
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: ScrollBar on Form

  #2  
May 11th, 2008
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!
Reply With Quote  
Join Date: Feb 2008
Posts: 404
Reputation: Jennifer84 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Jennifer84 Jennifer84 is offline Offline
Posting Pro in Training

Re: ScrollBar on Form

  #3  
May 12th, 2008
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 ?

Form2::VerticalScroll->Maximum;


Originally Posted by Duoas View Post
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 9:11 am.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,687
Reputation: Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all 
Rep Power: 9
Solved Threads: 160
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: ScrollBar on Form

  #4  
May 12th, 2008
I think I missing something ?
Yes, you are missing all the words I put in bold in my first response.
Reply With Quote  
Join Date: Feb 2008
Posts: 404
Reputation: Jennifer84 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Jennifer84 Jennifer84 is offline Offline
Posting Pro in Training

Re: ScrollBar on Form

  #5  
May 12th, 2008
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.

Originally Posted by Duoas View Post
Yes, you are missing all the words I put in bold in my first response.
Reply With Quote  
Join Date: May 2008
Posts: 274
Reputation: Radical Edward has a spectacular aura about Radical Edward has a spectacular aura about 
Rep Power: 2
Solved Threads: 46
Radical Edward's Avatar
Radical Edward Radical Edward is offline Offline
Posting Whiz in Training

Re: ScrollBar on Form

  #6  
May 12th, 2008
> 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 3:00 pm.
Subtlety is the art of saying what you think and getting out of the way before it is understood.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,687
Reputation: Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all Duoas is a name known to all 
Rep Power: 9
Solved Threads: 160
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: ScrollBar on Form

  #7  
May 12th, 2008
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 6:25 pm.
Reply With Quote  
Join Date: Feb 2008
Posts: 404
Reputation: Jennifer84 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Jennifer84 Jennifer84 is offline Offline
Posting Pro in Training

Re: ScrollBar on Form

  #8  
May 12th, 2008
No problem. I am using this code now and it seems to work fine for this purpose.
Thank you...

Form2::VerticalScroll->Value = 0;

Originally Posted by Duoas View Post
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 2:43 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC