DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   ScrollBar on Form (http://www.daniweb.com/forums/thread123723.html)

Jennifer84 May 11th, 2008 6:40 pm
ScrollBar on Form
 
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 ?

Duoas May 11th, 2008 10:51 pm
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!

Jennifer84 May 12th, 2008 10:08 am
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 ?

Form2::VerticalScroll->Maximum;


Quote:

Originally Posted by Duoas (Post 605097)
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!


Duoas May 12th, 2008 2:11 pm
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.

Jennifer84 May 12th, 2008 3:36 pm
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. :icon_neutral:

Quote:

Originally Posted by Duoas (Post 605534)
Yes, you are missing all the words I put in bold in my first response.


Radical Edward May 12th, 2008 3:59 pm
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.

Duoas May 12th, 2008 7:24 pm
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.

Jennifer84 May 12th, 2008 8:01 pm
Re: ScrollBar on Form
 
No problem. I am using this code now and it seems to work fine for this purpose.
Thank you...

Form2::VerticalScroll->Value = 0;

Quote:

Originally Posted by Duoas (Post 605684)
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.



All times are GMT -4. The time now is 6:49 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC