Solved

Application in Full-Screen mode

Posted on 2006-07-13
11
177 Views
Last Modified: 2010-04-05
Hi there, I have searched and searched on this site
how to make a application full-screen, but i didn't
found a good solution!

So I have made a beginning:

procedure TMainForm.ToolButton7Click(Sender: TObject);
begin
 with MainForm do
   WindowState := wsMaximized;
   FormStyle := fsStayOnTop;
   Left := 0;
   Top := 0;
   Height := Screen.Height;
   Width := Screen.Width;
   BorderStyle := bsNone;
   StatusBar1.Visible := false
end;
(*-----------------------------------------------*)
procedure TMainForm.ToolButton8Click(Sender: TObject);
begin
   with MainForm do
   FormStyle := fsNormal;
   BorderStyle := bsSizeable;
   StatusBar1.Visible := true
end;
(*-----------------------------------------------*)

I have several question about the procedures above:
1. How can I hide/show the statusbar?
2. When I press the ToolButton8 to get the screen in normal-state
    The rezise-button in the right-top corner doesn't work!

Who can help me out?

Greetings,

Peter
0
Comment
Question by:peterkiers
  • 6
  • 4
11 Comments
 
LVL 1

Expert Comment

by:Tueblo
ID: 17101604
You need to remember the coordinates yourself to switch back. You will need something like this:

FSavedCoords : array[0..3] of Integer;

And then this should do it:

procedure TMainForm.ToolButton7Click(Sender: TObject);
begin
 with MainForm do
   FormStyle := fsStayOnTop;
   FSavedCoords[0] := Left;
   FSavedCoords[1] := Top;
   FSavedCoords[2] := Height;
   FSavedCoords[3] := Width;
   SetBounds(0, 0, Screen.Width, Screen.Height);
   BorderStyle := bsNone;
   StatusBar1.Visible := false;
end;

procedure TMainForm.ToolButton8Click(Sender: TObject);
begin
  with Form1 do
    FormStyle := fsNormal;
    SetBounds(FSavedCoords[0], FSavedCoords[1], FSavedCoords[2], FSavedCoords[3]);
    BorderStyle := bsSizeable;
    StatusBar1.Visible := true;
end;

Also the StatusBar should now react correctly on the .Visible property.

Regards !
Tueblo
0
 
LVL 1

Expert Comment

by:Tueblo
ID: 17101638
Well, I have swapped the Height and Width values from FSavedCoords in ToolButton8Click(), but am sure you get the point. :)
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17101756
I am sorry, I don't get the point, what do I do wrong?

procedure TMainForm.ToolButton7Click(Sender: TObject);
begin
 with MainForm do
   WindowState := wsMaximized;
   FormStyle := fsStayOnTop;
   FSavedCoords[0] := Left;
   FSavedCoords[1] := Top;
   FSavedCoords[2] := Height;
   FSavedCoords[3] := Width;
   SetBounds(0, 0, Screen.Width, Screen.Height );
   Left := 0;
   Top := 0;
   Height := Screen.Height;
   Width := Screen.Width;
   BorderStyle := bsNone;
   StatusBar1.Visible := false

end;
(*-----------------------------------------------*)
procedure TMainForm.ToolButton8Click(Sender: TObject);
begin
   with MainForm do
   FormStyle := fsNormal;
   SetBounds(FSavedCoords[0], FSavedCoords[1], FSavedCoords[2], FSavedCoords[3]);
   BorderStyle := bsSizeable;
   StatusBar1.Visible := true
(*-----------------------------------------------*)

PK
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Expert Comment

by:Tueblo
ID: 17102123
Replace your function exactly with these, I mark the differences:

procedure TMainForm.ToolButton7Click(Sender: TObject);
begin
 with MainForm do
   // You don't need to change the WindowState
   // WindowState := wsMaximized;
   FormStyle := fsStayOnTop;
   FSavedCoords[0] := Left;
   FSavedCoords[1] := Top;
   FSavedCoords[2] := Width; // changed, now Width instead of Height
   FSavedCoords[3] := Height; // changed, now Height instead of Width
   SetBounds(0, 0, Screen.Width, Screen.Height);
   // SetBounds() will do the same as the four lines below
   // Left := 0;
   //Top := 0;
   // Height := Screen.Height;
   // Width := Screen.Width;
   BorderStyle := bsNone;
   StatusBar1.Visible := false;
end;

That should work...does it?
procedure TMainForm.ToolButton8Click(Sender: TObject);
begin
  with MainForm do
    FormStyle := fsNormal;
    SetBounds(FSavedCoords[0], FSavedCoords[1], FSavedCoords[2], FSavedCoords[3]);
    BorderStyle := bsSizeable;
    StatusBar1.Visible := true;
end;
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17102182
Your solution did help other problems I had, but the MainMenu-bar
still there.

P.
0
 
LVL 1

Expert Comment

by:Tueblo
ID: 17102206
MainMenuBar? You did not mention that before. What does it and where is the problem?
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17102274
AAAHHH, that was dumb of me, I ment the MainMenuBar not the statusbar.

p.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 17102405
The procedure works fine to make my application full-screen
except for the MainMenubar, I want to hide the mainmenubar also.
But I don't know how.
0
 
LVL 26

Accepted Solution

by:
Russell Libby earned 500 total points
ID: 17102571
To remove:

MainForm.Menu:=nil;

To restore

MainForm.Menu:={name of MainMenu component}

--

Regards,
Russell
0
 
LVL 1

Expert Comment

by:Tueblo
ID: 17102650
procedure TMainForm.HideTitle;
var actStyle : Integer;
begin
  actStyle := GetWindowLong(Handle, GWL_STYLE);
  SetWindowLong(Handle, GWL_STYLE, (actStyle and (not WS_CAPTION)));
  SetWindowPos(Handle, 0, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER or SWP_FRAMECHANGED);  
end;

You will now have the problem that you can not move the window anymore. This will allow moving by clicking anywhere on the window:

Put the following function in the private section of TMainForm:

procedure WMNCHitTest(var msg: TWMNCHitTest); message WM_NCHitTest;

And this is the implementation:

procedure TMainForm.WMNCHitTest (var msg: TWMNCHitTest);
begin
  inherited;
  if ( msg.Result = htClient ) then
    msg.Result := htCaption;
end;

0
 
LVL 1

Expert Comment

by:Tueblo
ID: 17102717
Cool
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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