Board index » delphi » StatusBar align bottom problem !!

StatusBar align bottom problem !!

One fix would be to set the Top property of the button bar.  That should
take car of most of your problems.  I have a feeling that the problem with
the resizing is because changing size does not effect the Top, only the
Height, so when the button bar gets taller while aligned to the bottom, the
Status Bar does what it can to get out of the way.
--Joe

Quote
Dave <da...@trumpet.com.au> wrote in message

news:365A2491.E197775E@hotmail.com...
Quote
> G'day,

> I have a form with a status bar on the bottom of it (aligned albottom),
>which behaves normally and as a Status bar should. However, I have a
>button panel which can be moved to the bottom or top of  the form, and
>if you move it to the bottom of the form (by simply setting its align :=
>albottom) then it appears BELOW the StatusBar, rather than sitting on
>top of it. If you change alignment in design time it sits nicely on top
>of the Status Bar as it should, but if you change it during runtime then
>it sits under it, as I have described.

> Also if you start off with the button panel at the base of the page
>(but above the status bar - set in design time), then upon resizing the
>form and making the button panel change its height (when buttons won't
>fit in the panel, it's height increases automatically to allow them to
>fit - set in OnResize event), the Status Bar pops up on top of the
>button panel again !!

> Is this a delphi bug ?? and if so is there a fix for it ?? Or am I just
>doing something obvioulsy dumb ??

> Any help gratefully reveived, thanks,

> Dave

 

Re:StatusBar align bottom problem !!


 G'day,

 I have a form with a status bar on the bottom of it (aligned albottom),
which behaves normally and as a Status bar should. However, I have a
button panel which can be moved to the bottom or top of  the form, and
if you move it to the bottom of the form (by simply setting its align :=
albottom) then it appears BELOW the StatusBar, rather than sitting on
top of it. If you change alignment in design time it sits nicely on top
of the Status Bar as it should, but if you change it during runtime then
it sits under it, as I have described.

 Also if you start off with the button panel at the base of the page
(but above the status bar - set in design time), then upon resizing the
form and making the button panel change its height (when buttons won't
fit in the panel, it's height increases automatically to allow them to
fit - set in OnResize event), the Status Bar pops up on top of the
button panel again !!

 Is this a delphi bug ?? and if so is there a fix for it ?? Or am I just
doing something obvioulsy dumb ??

 Any help gratefully reveived, thanks,

 Dave

Re:StatusBar align bottom problem !!


I tried this and got the correct results.  What do you mean by a
button panel?  I tried it by using a TStatusBar and a TPanel which
worked for me. Then I replaced the TPanel with a TToolBar and that
also worked.   Can you provide some more information?
 --- x
==============================
Xavier Pacheco (TeamB)
xav...@xapware.com

Sorry but TeamB cannot answer support
questions received via email.

Re:StatusBar align bottom problem !!


 Ok, a little more detail ...

 I've discovered that it occurs when the panel's height is changed. Try
this to see what I mean :

1) Create a form and put a status bar on it.
2) Put a panel on it, height=40, align=altop.
3) Now put a button on the form, with the following code in the Onclick
event:

  procedure TForm1.Button1Click(Sender: TObject);
  begin
    if panel1.align = altop then
       panel1.align := albottom
    else
       panel1.align := altop;
    panel1.height := 30;
  end;

4) Now run the app, and click the button 3 or 4 times (it doesn't do it
the first time round) ... Is it just me, or do you get the panel
appearing BELOW the status bar too ?

 Thanks for getting back to me, and I hope this makes the problem a bit
clearer. Is it a bug ? and is there a workaround ?

 Thanks in advance,

 Dave

Quote
"Xavier Pacheco (TeamB)" wrote:
> I tried this and got the correct results.  What do you mean by a
> button panel?  I tried it by using a TStatusBar and a TPanel which
> worked for me. Then I replaced the TPanel with a TToolBar and that
> also worked.   Can you provide some more information?
>  --- x
> ==============================
> Xavier Pacheco (TeamB)
> xav...@xapware.com

> Sorry but TeamB cannot answer support
> questions received via email.

Re:StatusBar align bottom problem !!


I tried it on my AMD 333Mhz system.  I hold down the enter which causes
button1 to press again and again.  Never saw a glitch.  Panel1 correctly
moved from top to bottom (above not behind status bar).  D4.02.

Dave <bw_d...@hotmail.com> wrote in article
<365B75B2.6C7D1...@hotmail.com>...

Quote
>  Ok, a little more detail ...

>  I've discovered that it occurs when the panel's height is changed. Try
> this to see what I mean :

> 1) Create a form and put a status bar on it.
> 2) Put a panel on it, height=40, align=altop.
> 3) Now put a button on the form, with the following code in the Onclick
> event:

>   procedure TForm1.Button1Click(Sender: TObject);
>   begin
>     if panel1.align = altop then
>        panel1.align := albottom
>     else
>        panel1.align := altop;
>     panel1.height := 30;
>   end;

> 4) Now run the app, and click the button 3 or 4 times (it doesn't do it
> the first time round) ... Is it just me, or do you get the panel
> appearing BELOW the status bar too ?

>  Thanks for getting back to me, and I hope this makes the problem a bit
> clearer. Is it a bug ? and is there a workaround ?

>  Thanks in advance,

>  Dave

> "Xavier Pacheco (TeamB)" wrote:

> > I tried this and got the correct results.  What do you mean by a
> > button panel?  I tried it by using a TStatusBar and a TPanel which
> > worked for me. Then I replaced the TPanel with a TToolBar and that
> > also worked.   Can you provide some more information?
> >  --- x
> > ==============================
> > Xavier Pacheco (TeamB)
> > xav...@xapware.com

> > Sorry but TeamB cannot answer support
> > questions received via email.

Re:StatusBar align bottom problem !!


Hey Pat,

 Thanks for the response, but this is really starting to bug me. After
getting your message, I figured I'd try some different machines (I'm using a
Pentium Pro 200MHz with Delphi 4.02 and the comctl32.dll v4.72.2106.4 ) to
see if they did the same. I got exactly the same results with a P2 - 266,
Delphi 4.02 and same dll. However when I tried a copy of Delphi 3 on a PPro
200 I didn't get the problem in the small test I described, BUT I did get it
in slightly differing circumstances.

 So try this out, and see if it happens :

 Test 2   :-)

 1) create a form and put a status bar on it. then add a panel to it and
align it bottom. Make the panel height about 40 or so.

 2) Now in the OnResize event for the form, put the following :

  procedure TForm1.FormResize(Sender: TObject);
  begin
    if form1.width < 300 then panel1.height := 80;
  end;

3) start the app (panel in right spot ABOVE the status bar), and shrink the
form down to less than 300 pixels in length, and unless I am the unluckiest
man around, you should see the panel pop BELOW the status bar.

 Surely I am not the only person who has come across this, or are all the
machines at work just haywire ?? If anyone could help me here I would really
appreciate it, since I am pulling out my hair over it, and can't even seem to
find anyone who has the same problem.

Thanks in advance,
Dave

Quote
Pat Riley wrote:
> I tried it on my AMD 333Mhz system.  I hold down the enter which causes
> button1 to press again and again.  Never saw a glitch.  Panel1 correctly
> moved from top to bottom (above not behind status bar).  D4.02.

Re:StatusBar align bottom problem !!


Dave,
 As Pat, I tried this and it works fine.
 -- x
==============================
Xavier Pacheco (TeamB)
xav...@xapware.com

Sorry but TeamB cannot answer support
questions received via email.

Re:StatusBar align bottom problem !!


Dave,

 >>  I am the unluckiest man around, you should see the panel pop
BELOW the status bar. <<

 Don't ever visit Vegas!   :)

  You've baffled me.  I know you've already gone through this but make
sure that you have the lastest controls and latest Delphi.  

 --- x
==============================
Xavier Pacheco (TeamB)
xav...@xapware.com

Sorry but TeamB cannot answer support
questions received via email.

Re:StatusBar align bottom problem !!


Quote
Dave wrote in message <365CC01C.64B98...@hotmail.com>...

> Test 2   :-)

> 1) create a form and put a status bar on it. then add a panel to it and
>align it bottom. Make the panel height about 40 or so.

> 2) Now in the OnResize event for the form, put the following :

>  procedure TForm1.FormResize(Sender: TObject);
>  begin
>    if form1.width < 300 then panel1.height := 80;
>  end;

>3) start the app (panel in right spot ABOVE the status bar), and shrink the
>form down to less than 300 pixels in length, and unless I am the unluckiest
>man around, you should see the panel pop BELOW the status bar.

I have good news for you, the Delphi Gods are not picking on you. I can
reproduce this very easily. In fact, just setting the height is all it
takes, no resizing necesssary:

procedure TForm1.Button1Click(Sender: TObject);
begin
  panel1.height := 80;
end;

What is apparently happening is the change in height puts the bottom of the
panel below the bottom of the statusbar and the alignment logic then orders
them accordingly. This is borne put of the following tests:

// change above line to:
  panel1.height := panel1.height + statusbar1.Height;

Order is maintained correctly.

// change above line to:
  panel1.height := panel1.height + statusbar1.Height + 1;

Oops, panel ends up under statusbar.

Not sure if there is any "easy" fix Inprise can do here - and, in fact,
could be argued as being "as designed" because this "feature" allows you to
*deliberately* switch positions of controls having the *same alignment
setting* simply by changing position or size.

There is an easy workaround however:

    with panel1 do begin
        Align := alNone;
        height := 80;
        Align := alBottom;
    end;

This works because by turning off alignment on the panel, the statusbar is
guaranteed to maintain its bottom position (the panel will be moved above
after setting height).

--
Wayne Niddery - WinWright Consulting
Delphi, C++Builder, JBuilder, InterDev --
http://home.ican.net/~wniddery/RADBooks.html
...remove chaff when replying...
"You know you've landed gear-up when it takes full power to taxi"

Re:StatusBar align bottom problem !!


Quote
"Wayne Niddery (TeamB)" wrote:

> I have good news for you, the Delphi Gods are not picking on you. I can
> reproduce this very easily. In fact, just setting the height is all it
> takes, no resizing necesssary:

> ...

> There is an easy workaround however:

  Aah, thanks so much - it is so nice to know I am not going insane :-) The
workaround is all I need for my app, and it now works fine. Can't tell you how
grateful I am,

 Dave

Other Threads