Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Statusbar resize problem.

Posted on 2006-11-11
7
Medium Priority
?
424 Views
Last Modified: 2010-04-05
Dear Experts,

I am trying to create something that allready exists in another application.

I have put 3 pictures of the original application on my site to let you see what
happens when the user resizes the application. You see 2 statusbars resizes very well
(the first statusbar where you see the text ‘keyboard Locked’ is on a TPanel).

URL:  http://members.home.nl/peterkiers/
Beneath the 3 pictures you can download the example I made by clicking
on the floppy.

When you have run my example, press Enter so the text 'Keyboard Locked' appears.
When you resize my example you'll see the statusbar at the bottom resizes jus fine.
But not the one on top. For the statusbar at the bottom I have used this procedure:

procedure TForm1.MainBarResize(Sender: TObject);
begin
  with MainBar do
    Panels[0].Width := Width - Panels[1].Width - Panels[2].Width
      - Panels[3].Width - Panels[4].Width;
end;

But the procedure above doesn't work for the statusbar on top.

Can someone help me, to solve this problem?


Greetings,

Peter Kiers
0
Comment
Question by:peterkiers
7 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 17921894
change:
procedure TForm1.MainBarResize(Sender: TObject);
begin
  with MainBar do

to

procedure TForm1.MainBarResize(Sender: TObject);
begin
  with sender as TStatusBar do

and assign to the hostbar onresize event the event of teh mainbar resize. it should do what you expect if I understood correctly your request.
0
 
LVL 17

Accepted Solution

by:
mokule earned 2000 total points
ID: 17921946
I can't see any problem.

I'm not sure where do you want to have the panels.
You should call DoResize after each Panels[1] changing size and in form creation

Additionally i would advice adding
  Panel1.DoubleBuffered := True;
in form creation

procedure TForm1.DoResize;
begin
  with Hostbar do
    Panels[2].Width := Width - Panels[1].Width - Panels[0].Width
      - Panels[3].Width - Panels[4].Width- Panels[5].Width - Panels[6].Width;
end;

(*---------------------------------------------------*)
procedure TForm1.HostbarResize(Sender: TObject);
begin
  DoResize;
end;

0
 
LVL 28

Expert Comment

by:TName
ID: 17922181
Hi,
Peter, I'm also not sure if I understand your problem. Do you want the status panel at the right to stay at the right as if it had an anchor akRight?
I've never used status panels, so there might be a property I don't know about (the others might tell you if there is one ;), but if not,  then you could try something like this:
Have one status panel (let's say nr 4) act like an invisible spacer. Let it stay "invisible" as it is, don't use it for anything else and let it push everything to the right of it by adapting it's width:


procedure TForm1.FormResize(Sender: TObject);
var
i,c:Integer;
begin
  c:=0;
  for i:=0 to HostBar.Panels.Count -1 do begin
     if i<>4 then
        c:=c+HostBar.Panels[i].Width;
  end;
  HostBar.Panels[4].Width:=HostBar.Width-c;
end;


This is just an idea, untested and maybe not necessary...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 28

Expert Comment

by:TName
ID: 17922201
Omg, forget it, this is exactly what mokule's solution does!!! Sorry, I should really really read the other posts thoroughly before posting!
So disregard my post please!  :/
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17922573
hi, thanks for all the help but I need a little time
to try out all the examples I received.

P.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17922757
I go for the answer from Mokule, his code works just fine.
Only i have one little question:

The 3 example pictures on my site you not only see that the
panels resize correctly, but also the width of the font gets smaller.
Does someone know how to do this?


Peter
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17924627
Because Mokule gave me the answer that I was looking for.
500p comming your way.

Greetings,

Peter Kiers
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question