[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Application in Full-Screen mode

Posted on 2006-07-13
11
Medium Priority
?
195 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 2000 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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

650 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