Jump to content
Roberto Colpani

Maximized the main form

Recommended Posts

Hi, I have this little problem: when I want to maximize my application the height don't care of the main task bar of windows; the height of my application is the height of the screen including the task bar.

Anyone have this problem or anyone know how to fix it?

Thanks.

Share this post


Link to post

Hi Roberto,

 

In the OnConstrainedResize event of the Form include the following:


MaxHeight:= Screen.WorkAreaHeight;
MaxWidth:= Screen.WorkAreaWidth;
 

This works for me. I have only 1 monitor, so I don't know how well it works in a multiple monitor setup.

 

Greetings,

Fons

 

Share this post


Link to post
23 hours ago, Fons N said:

Hi Roberto,

 

In the OnConstrainedResize event of the Form include the following:


MaxHeight:= Screen.WorkAreaHeight;
MaxWidth:= Screen.WorkAreaWidth;
 

This works for me. I have only 1 monitor, so I don't know how well it works in a multiple monitor setup.

 

Greetings,

Fons

 

This should not be necessary. It also seems like there would be scenarios which this would stop the user doing things they want to do. 

Share this post


Link to post
On 5/13/2022 at 9:17 AM, Roberto Colpani said:

Hi, I have this little problem: when I want to maximize my application the height don't care of the main task bar of windows; the height of my application is the height of the screen including the task bar.

Anyone have this problem or anyone know how to fix it?

Thanks.

Does this happen with a brand new VCL app with a single form that does nothing? If not then the answer is specific to your code. 

Share this post


Link to post
4 hours ago, David Heffernan said:

This should not be necessary. It also seems like there would be scenarios which this would stop the user doing things they want to do. 

Hi David,

 

With a vanilla VCL application it is not required. I use the TMS FNC Ribbon and when maximized it covers the Windows task bar.

 

image.thumb.png.817811f2fa791e5a16ac21dc07b5528a.png

 

In the Delphi Designer it looks like this.

 

image.thumb.png.d927a1cf00cd7052dcff52ccdda6fc56.png

 

 

When I run the application it looks like this. This is right after using the New Item template which creates a new application and form. I did not change a single thing.

 

image.thumb.png.2414dacf7cb3366a5971541c70a42913.png

 

Unfortunately, when maximized it covers the Windows task bar. Programming is just a hobby for me, though I do make application that are used at work (my job however has nothing to do with programming). The easiest way to fix it, was using the OnConstrainedResize event. I am not a bad Delphi programmer, just as long as it is standard Delphi code and not all kinds of trickery with Windows handles and such things.

 

I will report this to TMS Software. For the record, I use Delphi Pro 11.1 with patch 1. 

 

My simple solution for now works with 1 monitor. At work we use 2 or more. My solution probably has unwanted effects when using a multiple monitor setup. Not sure, but probably.

 

So, unless TMS fixes this, I will need some kind of workaround. The last resort option is to prevent the application from maximizing. 

 

Greetings,

Fons

 

Edited by Fons N

Share this post


Link to post
On 5/14/2022 at 10:34 AM, David Heffernan said:

This should not be necessary.

Hi David,

 

I reported it to TMS. They provided a solution. However, I finally decided to base my main form on the standard TForm and not TTMSFNCRibbonForm. 

 

This of course had some impact on the visual side of how the form looks, but I am okay with the end result. Now, maximizing the form works as excepted without any tinkering. Also, as a benefit when the user changes the width of the form with the mouse, the ribbon does not flicker anymore.

 

Greetings,

Fons

Share this post


Link to post
On 5/13/2022 at 10:26 AM, Fons N said:

In the OnConstrainedResize event of the Form include the following:


MaxHeight:= Screen.WorkAreaHeight;
MaxWidth:= Screen.WorkAreaWidth;

You could use the Constraints property of the form instead of using the Event.

 

Self.Constraints.MaxHeight := Screen.WorkAreaHeight;
Self.Constraints.MaxWidth := Screen.WorkAreaWidth;
 

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×