Solved

Statusbar resize problem.

Posted on 2006-11-11
7
415 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 500 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 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