Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TScrollBox and scrollbars

797 views
Skip to first unread message

Simon Bowyer

unread,
Aug 30, 2001, 6:56:53 AM8/30/01
to
I have a window that is made up of a number of panels. One of the panels is
aligned as alClient and has a scroll box with the same alignment on it. At
run time, I am creating a new instance of a component I created based on a
TPanel that consists of a number of panels and grids and I'm setting the
parent property to the scroll box. I want the scroll box to display a
vertical scroll bar when I have 2 or more of my components displayed but it
doesn't want to display for some reason. I tried setting it to autodisplay
and setting it to visible in code but still no bar. What do I need to do to
get a scroll bar to appear?

Thanks
Simon


Peter Below (TeamB)

unread,
Aug 30, 2001, 6:47:07 PM8/30/01
to

Set the Autoscroll property to true. The control will then display scrollbars
if any of the controls in it extend beyond the controls client area. You can
also set the scrollbars range properties manually if you leave Autoscroll
false.


Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Simon Bowyer

unread,
Aug 31, 2001, 3:50:17 AM8/31/01
to
I tried it with autoscroll set to true and nothing happened. Is there
anything else I can do? Is there something I have to set in my new component
so the scroll box knows how big it is?

Thanks
Simon

"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote in message
news:VA.0000782...@antispam.compuserve.com...

Peter Below (TeamB)

unread,
Aug 31, 2001, 4:11:24 PM8/31/01
to
In article <3b8f4180$1_2@dnews>, Simon Bowyer wrote:
> I tried it with autoscroll set to true and nothing happened. Is there
> anything else I can do? Is there something I have to set in my new component
> so the scroll box knows how big it is?

Something is not right here. I just made a simple test program, one scrollbox,
with all properties at default (Autoscroll = true, autosize = false), one
button with

procedure TForm1.Button1Click(Sender: TObject);
var
y, w: Integer;
i: Integer;
begin
y:= 0;
w:= scrollbox1.ClientWidth - getsystemmetrics( SM_CXVSCROLL );
for i:= 1 to 10 do
with TPanel.Create( self ) do begin
parent := scrollbox1;
setbounds( 0, y, w, 50 );
caption := Format('Panel %d at %d', [i, y ] );
Inc(y, 50 );
end;
end;

Run, click button => scrollbox full of panels and with a beautiful vertical
scrollbar. (D6, Win2K)

Simon Bowyer

unread,
Sep 1, 2001, 6:38:13 AM9/1/01
to
Peter

Thanks for your continued help. I have "fixed" the problem by increasing the
width of the form by 1 and then back again. Not a very nice fix but it
seemed to work!

Not sure if I'm supposed to ask another unrelated question without starting
a new thread but...

is there anyway of setting the font attributes of a single item in a tree
view? I want to use bold and colour to make the display a bit more user
friendly and indicate state to the user of certain items - namely coloured
silver for unavailable. I tried using images but it looked awful!

Thanks in advance
Simon

"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote in message

news:VA.0000785...@antispam.compuserve.com...

Peter Below (TeamB)

unread,
Sep 2, 2001, 4:31:55 AM9/2/01
to
In article <3b90ba64$1_1@dnews>, Simon Bowyer wrote:
> Not sure if I'm supposed to ask another unrelated question without starting
> a new thread but...

You are not <g>.

> is there anyway of setting the font attributes of a single item in a tree
> view? I want to use bold and colour to make the display a bit more user
> friendly and indicate state to the user of certain items - namely coloured
> silver for unavailable. I tried using images but it looked awful!

You have to use the custom draw support build into the TTreeview class. Look
at the help for OnAdvancedCustomDrawItem. Search for examples in the archives,
this is a fairly frequent question.

http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

0 new messages