Solved

Statusbar resize problem.

Posted on 2006-11-11
7
408 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:ciuly
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now