Board index » cppbuilder » TScrollBox and its Scroll bars

TScrollBox and its Scroll bars

Hi I have a TScrollBox that well simply wont scroll when the Scroll bars
Visible property is set to false. If sbCourses->VertScrollBar->Visible is
set to true then everything works as it should. This quoted straight from
the help tells me it should.

QUOTE FROM BCB 6 HELP>> "If Visible is set to true, a scroll bar appears
whenever a visual component is less than Margin pixels from the edge of the
form or scroll box. If Visible is set to false, the scroll bar is never
visible. This is useful, for example, for programmatically controlling the
scroll position of a form without allowing the user to control the scroll
position."

However setting the scroll bar postion manually does not work (unless
sbCourses->VertScrollBar->Visible == true of course).

   if (sbCourses->VertScrollBar->Position <
(sbCourses->VertScrollBar->Range - sbCourses->ClientHeight))
   {
      for (int i=0; i<(sbCourses->VertScrollBar->Range -
sbCourses->ClientHeight); i+=3) // This loop works.
      {
         sbCourses->VertScrollBar->Position = i; // This line runs but
Position does not change.
         sbCourses->Update();
      }
      sbCourses->VertScrollBar->Position = sbCourses->VertScrollBar->Range -
sbCourses->ClientHeight;
   }

I'm using BCB6 and any help would be greatly appreciated.

--
Michael Bushby
IQWorks Ltd
Ph 343 1202.
Fax 343 1118
Cell 021 888 027
Mich...@EnterpriseRetailSolutions.co.nz
2B Michelle Rd
Sockburn
Christchurch
P.O. Box 7472
Sydenham

This message and the information contained therein is intended only for the
use of the person(s) ("the intended recipients(s)") to whom it is addressed.
It may contain information that is privileged and confidential within the
meaning of applicable law.  If you are not the intended recipient, please
contact the sender as soon as possible.  If you are not the intended
recipient of this message you are hereby notified that you must not
disseminate, copy or take any action in relation on it.
The views expressed in this communication may not necessarily be the views
held by IQWorks Ltd.
The contents of an attachment to this e-mail may contain viruses that could
damage your own
computer system.  While every reasonable precaution has been taken to
minimise this risk, IQWorks Ltd. cannot accept liability for any damage
which you sustain as a result of software viruses. You should carry out your
own virus checks before opening the attachment.

 

Re:TScrollBox and its Scroll bars


Quote
Michael Bushby wrote:

> Hi I have a TScrollBox that well simply wont scroll when the Scroll bars
> Visible property is set to false.

A workaround can be done in the following way: The VertScrollBar is Visible
but it is covered by the ScrollBox Parent.

If the ScrollBox does not cover the whole form than place it on a TPanel.

In the TPanel's OnResize() event put the following code:

void __fastcall TForm1::Panel1Resize(TObject *Sender)
{
ScrollBox1->Align = alClient;
ScrollBox1->Align = alNone;
ScrollBox1->width += 20;

Quote
}

Otherwise you can place this code in the TForms OnResize().

Maybe you have to call this code once in the constructor.

Hans.

Re:TScrollBox and its Scroll bars


When Visible is false, try using the inherited ScrollBy() method of the
TScrollBox instead of setting the Position properties.

Gambit

Quote
"Michael Bushby" <Mich...@IQWorks.co.nz> wrote in message

news:3ce17c40$1_1@dnews...
Quote
> However setting the scroll bar postion manually does not work (unless
> sbCourses->VertScrollBar->Visible == true of course).

Other Threads