Discussion:
Showing only one scrollbar in a TScrollBox.
(too old to reply)
Jason Cipriani
2008-06-30 07:42:19 UTC
Permalink
I'm trying to disable the horizontal scrollbar, and *always* show the
vertical scrollbar (no matter what) in a TScrollBox.

The AutoScroll property doesn't seem to work as documented, or I'm reading
the documentation wrong.

When I set AutoScroll to false the scrollbars, of course, don't appear.
However, I'm not sure how to make them appear manually. The documentation
says "use the HorzScrollBar and VertScrollBar properties to set scroll bar
visibility" -- but I'm not sure what this means because those properties are
TScrollBars, not bools. The documentation for VertScrollBar reads "use
VertScrollBar to hide, show, or manipulate the vertical scroll bar for the
scrolling windowed control". I'm not sure what that means either, for the
same reason, and the example code in the documentation doesn't demonstrate
that technique. The obvious thing is to set the Visible property of the
horizontal and vertical scrollbars accordingly, but this property seems to
have no effect on their visibility. How do I control the visibility of
scrollbars in a TScrollBox?

Thanks,
Jason
Bruce Larrabee
2008-06-30 09:10:36 UTC
Permalink
Hi Jason,

Access the ScrollBox in the object inspector,
you'll find the scroll bars under the
Miscellaneous section, there should be a
box with a plus (or minus) sign to the left
of HorzScrollBar and VertScrollBar clicking
on the plus sign allows access to the scrollbars
properties... You'll notice the scrollbar
'Visible' property can be set here for example.

Of course you can also set these properties at
runtime:

scroll_box->HorzScrollBar->Visible = false;

HTH,

Bruce
Remy Lebeau (TeamB)
2008-06-30 16:55:24 UTC
Permalink
Post by Jason Cipriani
When I set AutoScroll to false the scrollbars, of course, don't appear.
However, I'm not sure how to make them appear manually. The
documentation says "use the HorzScrollBar and VertScrollBar
properties to set scroll bar visibility" -- but I'm not sure what this
means because those properties are TScrollBars, not bools.
They are TControlScrollBar objects, actually. TControlScrollBar has its own
properties, such as Visible, ie:

ScrollBox->HorzScrollBar->Visible = false;
Post by Jason Cipriani
The documentation for VertScrollBar reads "use VertScrollBar
to hide, show, or manipulate the vertical scroll bar for the scrolling
windowed control". I'm not sure what that means either
You are not following the links in the documentation to see what
TControlScrollBar itself exposes.
Post by Jason Cipriani
The obvious thing is to set the Visible property of the horizontal
and vertical scrollbars accordingly, but this property seems to have
no effect on their visibility.
Works fine for me. Do you have any controls that are actually behind the
boundaries of the TScrollBox's visible area?


Gambit
Jason Cipriani
2008-06-30 18:29:40 UTC
Permalink
Post by Remy Lebeau (TeamB)
Post by Jason Cipriani
The obvious thing is to set the Visible property of the horizontal
and vertical scrollbars accordingly, but this property seems to have
no effect on their visibility.
Works fine for me. Do you have any controls that are actually behind the
boundaries of the TScrollBox's visible area?
I'm sorry, I was tired when I wrote that and really unclear. I want to show
a vertical scrollbar even when one is not necessary (i.e. a disabled one).
Can I do this? Setting AutoScroll to false and VertScrollBar->Visible to
true doesn't force the scrollbar to be visible.

Thanks,
Jason

Loading...