Scroll Bar does not appear when Form resizes


  Hi,

  I am using Delphi 5. I have an MDI application. In child forms I have a Panel (align=alTop), a grid (align=alclient) and another panel (align=albottom).Buttons , editboxes etc. are on those top and bottom panels. Child forms have (borderstyle=bssizeable) .

 Problem:
  When the child forms  are resized, the horizontal scroll bar of the form do not appear even if the form is resized to a smaller width than its original.

 I think this happens because the panels have align properties. They also get smaller with form, so horizontal scroll bar does not appear.

 What can be  a solution to this problem? I want to resize the form but the horizonal scroll bar must be seen when necessary..

Thanks.
caglar_okatAsked:
Who is Participating?
 
Slick812Commented:
??? not so sure about what ot why you are asking this?, the auto-scrollBars of a form only are used when componenets are OFF the client area. If you have your panels Aligned to top and bottom, then they are resized with the form, and are still with in the client area. . . So you seem not to want to set your panels NOT to be aligned, if you want them to NOT change size with the form, then do NOT align them with the form, I guess you want them to be at the top and bottom, but not to be changed in width? ? If so you may need to do that yourself.
0
 
Scay7Commented:
In the onformcreate did you try making it visible := true;
0
 
caglar_okatAuthor Commented:

 Unfortunately this doesn't help. The problem is, form doesn't show the horizontal scroll bar because the albottom and altop panels gets smaller when form gets smaller.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Slick812Commented:
I just remembered, , The Anchors  property, may be better for this, you can set the Anchors to  akTop  or  akBottom and Align to alNone, and this may do what you need?
0
 
caglar_okatAuthor Commented:
Yes, I want the two panels to be at the top and bottom.

I tried doing it with anchors. I set the appropriate anchors values for the two panels and the grid. When using anchors the horz. scrollbar appears (since the panels do not change widths as form gets smaller.)

But there are some  problems with anchors property,
 when I make the form very smaller (the grid is not seen) , the top and bottom panels overlap.(if I use align they do not overlap).
 when the form is too small as the grid can not be seen, if I scroll the form's scrollbar to the right, the grid loses its original distance to the bottom edge (when I make the grid bigger), and gets behind the bottom panel.The grid behaves like it is anchored to the bottom edge (as if there is no bottom panel).

0
 
Slick812Commented:
OK, I really do Not understand any  about the "Grid", and it's positions, , but here is a way to have the Bottom panel do exactly as you want it to, you can position it to anywhere you want in the Parent's (a TForm in this cace) OnResize event, , the Panel1 is the TOP Panel, and Panel2 is the BOTTOM Panel , , ,both of these TPanels have the Default settings, Align= alNone, Anchors= [akLeft, akTop] -


procedure TForm2.FormResize(Sender: TObject);
begin
if ClientHeight > Panel1.Height + Panel2.Height {+Grid1.Height} then // test for the minimum you will need here
  Panel2.Top := ClientHeight - Panel2.Height // move the Panel2 to the position you may require, I place at bottom
  else // if less than minimum, then place at bottom of Panel1
  Panel2.Top := Panel1.Height {+Grid1.Height}; // add any amount for more separation
end;


 = = = = = = = = = =  = =
you can test for the minimum with whatever amount you need to preserve (IE, something to do with the grid) and then place the Panel2 where you need it, , ,you can also move the grid to the position for best visiblility
0
 
caglar_okatAuthor Commented:

 Thanks for the answers. I was wondering if there is an easy method for solving this problem other than writing code in some events.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.