Board index » cppbuilder » Resizing a scrollbox

Resizing a scrollbox


2005-03-18 11:54:13 AM
cppbuilder99
I have a TScrollBox (BTW I'm using C++Builder 3.0) that I am placing button
objects on at runtime (I have a few I can select from and they are placed
programmatically in the scrollbox). I'm essentially building a block diagram
of a control system using buttons in the scrollbox. However, I have yet to
figure out how to make the scrollbox get bigger if I need the space. Any
suggestions on how to do this?
Jon
 
 

Re:Resizing a scrollbox

Jon Berndt wrote:
Quote
I have a TScrollBox (BTW I'm using C++Builder 3.0) that I am placing button
objects on at runtime (I have a few I can select from and they are placed
programmatically in the scrollbox). I'm essentially building a block diagram
of a control system using buttons in the scrollbox. However, I have yet to
figure out how to make the scrollbox get bigger if I need the space. Any
suggestions on how to do this?
Have a look at ScrollBox1->Width ans ScrollBox1->Height.
But the idea behind a TScrollBox is not to make it bigger
but to let the user scroll.
Hans.
 

Re:Resizing a scrollbox

"Hans Galema" < XXXX@XXXXX.COM >wrote in message news:423a89d7
Quote
Jon Berndt wrote:
>I have a TScrollBox (BTW I'm using C++Builder 3.0) that I am placing
button
>objects on at runtime (I have a few I can select from and they are
placed
>programmatically in the scrollbox). I'm essentially building a block
diagram
>of a control system using buttons in the scrollbox. However, I have yet
to
>figure out how to make the scrollbox get bigger if I need the space. Any
>suggestions on how to do this?

Have a look at ScrollBox1->Width ans ScrollBox1->Height.

But the idea behind a TScrollBox is not to make it bigger
but to let the user scroll.

Hans.
You misunderstood my question: I don't want to make the control itself
larger - I want to make the "client area" (that can be scrolled) larger. If
my control system diagram needs more space, how do I create that? My
ScrollBox control is aligned to the client area of my main window - say,
600x300 pixels. But, after I have begun editing my control system, I may
find that I need 1200 pixels wide. Setting the Width of the ScrollBox has no
effect for the case where it is aligned to the client area of the parent
object, because you can't change the actual width of the control. I want to
change the width of the scrollable area inside the ScrollBox.
Jon
 

{smallsort}

Re:Resizing a scrollbox

"Jon Berndt" < XXXX@XXXXX.COM >wrote in message
Quote
I want to make the "client area" (that can be scrolled) larger.
The client area resizes automatically based on the actual controls you place
on it.
Quote
If my control system diagram needs more space, how do I create that?
You don't need to do anything.
Quote
Setting the Width of the ScrollBox has no effect for the case
where it is aligned to the client area of the parent object, because
you can't change the actual width of the control.
You don't need to do anything for that. The size of the client area of the
ScrollBox is separate from the size of the ScrollBox itself. The
ScrollBox's size does not matter. The contents of the ScrollBox control the
size of the client area.
Gambit
 

Re:Resizing a scrollbox

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote
Quote
"Jon Berndt" < XXXX@XXXXX.COM >wrote in message
>Setting the Width of the ScrollBox has no effect for the case
>where it is aligned to the client area of the parent object, because
>you can't change the actual width of the control.

You don't need to do anything for that. The size of the client area of
the
ScrollBox is separate from the size of the ScrollBox itself. The
ScrollBox's size does not matter. The contents of the ScrollBox control
the
size of the client area.

Gambit
I see. So, if I have a client area in my scrollbox that is currently 600
wide and 300 high, and I want to place a control at (640,150) I would simply
place the control there programmatically and the scrollbox would resize
itself? That helps, and that's good, but it presents a bit of a problem if I
want to drag and drop a control beyond the current limits (as in the example
I gave). One solution would be to programmatically place a "ghost" control
at the x,y location that would result in sizing the scrollbox as I desire.
Good solution?
Thanks for your input - that really helps.
Jon
 

Re:Resizing a scrollbox

"Jon Berndt" < XXXX@XXXXX.COM >wrote in message
Quote
it presents a bit of a problem if I want to drag and drop a control beyond
the current limits (as in the example I gave). One solution would be to
programmatically place a "ghost" control at the x,y location that would
result in sizing the scrollbox as I desire. Good solution?
During dragging, you can try detecting when the dragged control is being
held near the ScrollBox's edge, and then continuously increase the
ScrollBox's client area manually until the user moves the control away from
the edge. You don't need ghost objects.
Gambit