Solved

Statusbar resize problem.

Posted on 2006-11-11
7
417 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

623 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