Solved

Application in Full-Screen mode

Posted on 2006-07-13
11
183 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
[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
  • 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
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 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create Database on Android via Delphi dbExpress 3 129
Dev express lookupcombo 3 46
DBCtrlGrid, Delphi, Scroll 7 33
Problem working with dynamic array - help 2 36
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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