Solved

Application in Full-Screen mode

Posted on 2006-07-13
11
186 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
Technology Partners: 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

696 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