Help needed with the SizeGrip of the Statusbar.

Hi,

I have a statusbar with 4 panels, one for the information and the other 3 for the
Capslock, NumLock and ScrollLock-keys. I have put the dfm of the statusbar along
with the OnResize-event in the code-section. The Statusbar itself resides on a panel
and it has to stay there. First I like to tell you how my the statusbar should react based
on another application, and then I tell you how my statusbar reacts.

This is what I would like the sizegrip of my statusbar to do:
1. The application starts in wsMaxized then the size grip has to be gone (example1).
2. When the application gets resized then the sizegrip has to be available (example2).

When my application starts I have it just like example1 but thats because I have
sizegrip = false. When I resize the application there is still no sizegrip and there
should be one, and next to the last panel not in the last panel (Because that's
what I get when i start my application with sizegrip = true).

Who knows the answer and is willing to help me?
because I have tried a lot of thing with no succes.

Who can help me with this?

Peter Kiers
object StatusBar1: TStatusBar
      Left = 0
      Top = 122
      Width = 800
      Height = 19
      Panels = <
        item
          Bevel = pbNone
          Width = 200
        end
        item
          Alignment = taCenter
          Width = 40
        end
        item
          Alignment = taCenter
          Width = 40
        end
        item
          Alignment = taCenter
          Width = 40
        end>
      SizeGrip = False
      OnResize = StatusBar1Resize
    end
  end

procedure TMainForm.StatusBar1Resize(Sender: TObject);
begin
  with StatusBar1 do
    Panels[0].Width := Width - Panels[1].Width -
      Panels[2].Width - Panels[3].Width;
end;

Open in new window

Example1.jpg
Example2.jpg
LVL 1
peterkiersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel PASQUIERFreelance Project ManagerCommented:
Hello Peter,

Can you provide an image of what you have because I don't understand this statement :
> next to the last panel not in the last panel

Also, why your status bar is not on the main form directly, where it is normally in applications ? why the need to put it on a Panel ? Is this panel bottom-aligned with the main form ?

Can you provide the whole DFM ? or at least all the objects in which this panel is ?
0
Geert GOracle dbaCommented:
a statusbar inside a panel doesn't have size grip
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
peterkiersAuthor Commented:
First example is my application
second example is another application

MyApp.jpg
OtherApp.jpg
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

peterkiersAuthor Commented:
and Mahdi advised me to put the statusbar on a panel in my prev. question.
"Question about the statusbar"

P.
0
peterkiersAuthor Commented:
For Geert yes it does see example MyApp.
0
Geert GOracle dbaCommented:
if you never want a sizegrip then you need to create your own descendant of the statusbar
and switch the option off



procedure TCustomStatusBar.CreateParams(var Params: TCreateParams);
const
  GripStyles: array[Boolean] of DWORD = (CCS_TOP, SBARS_SIZEGRIP);
begin
  InitCommonControl(ICC_BAR_CLASSES);
  inherited CreateParams(Params);
  CreateSubClass(Params, STATUSCLASSNAME);
  with Params do
  begin
    Style := Style or GripStyles[FSizeGrip and FSizeGripValid];
    if ThemeServices.ThemesEnabled then
      WindowClass.style := WindowClass.style or CS_HREDRAW or CS_VREDRAW
    else
      WindowClass.style := WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);
  end;
end;

in your descendant, you'll need to override this:

let's assume you create a TPKStatusbar (Peter Kiers Statusbar)  :)

procedure TPKStatusBar.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do
    Style := Style and not SBARS_SIZEGRIP;
end;
0
peterkiersAuthor Commented:
oeps, your right Geerts, when I use the sizegrip I can move the panels over the statusbar.

Your right.

P.
0
Geert GOracle dbaCommented:
it does an extra check to see if the lower right corner is the same as the form lower right corner
0
peterkiersAuthor Commented:
Oke, WAIT let me refrase my question.

I go for a sizegrip in full-mode and in resize-mode, but the sizegrip has to be
next to the last panel and not in the last panel.

Peter
0
Geert GOracle dbaCommented:
easiest (nasty) fix for you would be to hide the size grip

put this above your form declaration
type
  TStatusbar = class(ComCtrls.TStatusbar)
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  end;

  // etc
  TForm1 = class(TForm)
 
and then in the implementation

imlementation

uses // etc

procedure TStatusBar.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do
    Style := Style and not SBARS_SIZEGRIP;
end;
0
Geert GOracle dbaCommented:
or create an extra panel at the end with a bevel of pbNone

0
Emmanuel PASQUIERFreelance Project ManagerCommented:
> Mahdi advised me to put the statusbar on a panel in my prev. question.
> "Question about the statusbar"
Yes, I saw that but was wondering why it is necessary and did not ask. What's the problem with the statusbar in the main form ?
0
Geert GOracle dbaCommented:
see with the extra statusbar panel  :

statbar (5) panels, and extra pbNone on 2 and 5 for bevel
statbar.png
0
peterkiersAuthor Commented:
I have created an extra panel but the problem is the OnResize-procedure!
when put panel4 not in the procedure, nothing happens it still the same (sizegrip in the last panel)
when I add panel 4 in the procedure, its just what i want ONLY the form does not risize.
You can move the panels over the statusbar.

P.
0
peterkiersAuthor Commented:
For Espasquier:
When I do not put the statusbar on a panel but below the panel, and I resize the listview with the splitter.
When I go with the splitter all the way down to the statusbar and the go up again the statusbar then resize with it.
See the picture of my previous question.
0
Geert GOracle dbaCommented:
what panels over the statusbar ?
are you moving TPanels around in your form ?

The statusbar is lowest in the Z-order, everything goes on top of that
(except things like a TLabel)

procedure TMainForm.StatusBar1Resize(Sender: TObject);
begin
  with StatusBar1 do
    Panels[0].Width := Width - Panels[1].Width -
      Panels[2].Width - Panels[3].Width - Panels[4].Width;
end;
0
Geert GOracle dbaCommented:
you could solve that with putting all the rest in a TPanel

start with a TPanel -> panelMain (align = alClient)
and below that the TStatusbar
all the rest goes into the panelMain

0
Geert GOracle dbaCommented:
it's a bit difficult if you mix other question in with this to follow
0
peterkiersAuthor Commented:
I show you:
example1: This is good just like i wanted it.
example2: when I use the sizegrip i can move the panels over the statusbar
                  The form itself doesn't risize.


AtStartup.jpg
DragPanels.jpg
0
Mahdi78Commented:
Hello peter
Please check my answer to your question
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_25677165.html

I had two answer, first with statusbar in panel and second with statusbar in form, and i suggested you to use my second answer, check again ;)
0
peterkiersAuthor Commented:
This is going the wrong way.

Let me try another approach:
And i got this from another application.

1. The app start in wsMaximized there is no sizegrip and the maximed/minimized button is set to minimized.
2. when the user clicks on the button because he want to minimized the form, the form's size stays the same
    only the sizegrip appears, so the user can resize the form himself.

How can I do that?

P.
0
peterkiersAuthor Commented:
I got it.
You where all right the reason is that my statusbar was on a panel.
Thank your for all the responses.

Peter
0
Mahdi78Commented:
Check sample of my second answer to that question
file attached
Project1.exe
0
Mahdi78Commented:
Sorry both solution statusbar was on panel, but second was in separated panel
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.