Topic: Maximize all my forms

Hi everyone,
What I would like to do is to have ALL of my forms open MAXIMIZED.  I'm thinking that if this were to happen then my program would fit on whatever screen size the user has.  When I use the Maximize button on any of my forms it does exactly that.  However I think it would be nice if this were to happen automatically.  If my logic is flawed please let me know.
.
Here's what I have tried.
On the SHOW event of my Main form I put this code:
procedure frmMainMenu_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
   frmMainMenu.WindowState := wsMaximized;
end;

This only works partially.
.
Next I created a button on my Main form:
procedure frmMainMenu_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
   frmMainMenu.WindowState := wsMaximized;
end;

This works better and does seem to affect the other forms.  However I'd like to do this without the user having to click on a separate button if possible.
.
Your thoughts will be appreciated.
Thanks
Frank

Re: Maximize all my forms

A-Hoy Frank,
Maybe I'm misunderstanding but if you want all your forms to open automatically in a maximised state, can't you just add

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
  form1.WindowState := wsmaximized;
end;

I'm not sure why you need to use an additional button to maximise things? 
And on every form that gets opened, just add the same line of script on  the 'on_show' event.
I've just quickly changed something I was messing around with to demonstrate it working (so ignore everything else apart from the 'windowstate:= wsmaximized lines in the script).  Use right-click in the grid to toggle the options pop-up.
Derek.

Post's attachments

Attachment icon template7.zip 412.32 kb, 124 downloads since 2022-09-06 

Re: Maximize all my forms

Derek,
I had tried earlier to put the code you suggested in my frmMainMenu SHOW event
// Maximize the form
  frmMainMenu.WindowState := wsMaximized;

.
And it does work and it does Maximize the screen, however it does not go to the top of the screen.  There's about 1/4" of the screen behind my MainMenu screen.
And if I double-click on the double box icon it does make the screen smaller.
Then if I double-click on the single box it does Maximize the form and this time it does fill my screen.
Strange ??
I tried to get an image of what I'm describing but I was not successful.
.
I do use some scaling in the code for this form to get it to fit on my screen.  So I turned this off and it does the same thing.
.
I'll keep working on it.
Thanks
Frank

4 (edited by Destiny 2022-09-06 07:12:45)

Re: Maximize all my forms

Hello, is it not enough to "Maximize" in the property?

Post's attachments

Attachment icon Maximized.jpg 4.68 kb, 48 downloads since 2022-09-06 

Destiny

Re: Maximize all my forms

Hi Frank,
The only other thing that comes to mind is try changing the form 'borderstyle'. 
I'm guessing you've currently got it set to 'bssizeable' which you don't need if you always want it to show full screen. 
Try it with either 'bssingle' or 'bsdialog' instead and see if that makes any difference.
Derek.

Post's attachments

Attachment icon frank full screen.jpg 107.87 kb, 53 downloads since 2022-09-06 

6 (edited by sparrow 2022-09-06 10:42:32)

Re: Maximize all my forms

Hi Derek, Frank


You also need to pay attention to Constraints - maxWidth an maxHeight. Must be set to 0.

7 (edited by papafrankc 2022-09-07 15:03:17)

Re: Maximize all my forms

Destiny,
Trying to Maximize the form as you suggested is what I originally tried, and it didn't work out for me.
I may have other problems, please read on.
.
Derek, Sparrow,
I've been trying all kinds of things and I'm not getting the combination of settings that seem to work the way I would like.
.
I'd like to back up and ask a couple of basic questions:
First - Some time ago I asked about how to size my program to different size screens.  The forum was kind enough to give me suggestions as you always do.  And I know I learn things, but maybe not all I need to learn sad
I have some code in my main form ONSHOW . Here's a partial example of what I have:
if screen.width = 1920 then
   begin
     vscale := 170;
     //showmessage('w=1920, first check') ;
   end

.
for vi := 0 to Screen.FormCount - 1 do
  Screen.Forms[vi].ScaleBy(vscale,screen.pixelsperinch);

.
I test for a number of screen sizes and it works OK on the 2 different size laptops I have. (this was before I got into the Maximize issue)
I have no idea what it would look like on a desktop or a larger monitor?
.
And I have no idea as to what size of computer screen my user will have?
So my question is how do you folks size your applications to fit various size computer screens?
And also, eventually what do you do with the Maximize issue?
.
To me, it looks like this is quite important and I'm wondering what the different types of solutions are?
.
.
Thanks for the help all of you have given me over the last couple of years.  I'm now able to do quite a few general, simpler things by myself because of your help. But when I get into some of the things that I do, it quickly reminds me of how much I don't know.
.
Frank

8 (edited by sparrow 2022-09-07 12:35:34)

Re: Maximize all my forms

Frank, I'm very sorry, but as I already wrote, there is some moment in the development of the project
when the code is large enough and Derek and I cannot understand where and why it does not work.
What settings, in what place and in what sequence affect the operation of the program. Sorry.
Without seeing the project, we will not provide assistance.


As far as maximize is concerned, I leave this point to the user's decision.
Expand to full screen or leave in a window. It is impossible to take into account all the moments,
nuances, adapt to them and make a program for all occasions.
Let the user work with his hands and head.
Your default form should, if possible, display normally at a reasonable minimum resolution
(let's say 1280 x 768 for a laptop). And expanding to full screen is not a problem.
But that's just my point of view.
My wife says I'm old and grouchy. ))) and she's right.

9 (edited by Destiny 2022-09-07 12:53:52)

Re: Maximize all my forms

Hello, try this little software that adapts your programs to all screens. It is a software without installation and free.
It is called QuickChangeResolution.

Post's attachments

Attachment icon QuickChangeRésolution.jpg 35.97 kb, 49 downloads since 2022-09-07 

Destiny

10 (edited by k.krause 2022-09-07 12:52:30)

Re: Maximize all my forms

Hi Sparrow. No, you are not grumpy. I agree with your vision.

11 (edited by papafrankc 2022-09-07 15:04:24)

Re: Maximize all my forms

Sparrow,
I agree completely with your explanation.  Last night, after I posted my question, I was thinking that I should just leave it to the user to decide whether they want full screen or not.  I know personally that sometimes I'm OK with a screen size as it is and sometimes I like full screen.  Youtube is an example.  Sometimes I just watch a clip in the smaller screen and sometimes I want to see more detail, so I make it full screen.
.
I believe I've been trying to make the program perfect when there's a point where it's fine as it is. 
.
Almost all of the basic functionality in my program is working fine now, thanks to the help you folks have provided me.
As I'm going through my final testing and clean up, I sometimes see something that I think could be changed to make it better.  However I now realize that some of my 'fixes' just might not be worth the effort.
.
Destiny, thanks for your suggestion, I'll check it out.
.
Thanks for your help
Frank

Re: Maximize all my forms

perfect program))) Even Ms-Dos with its black screen and prompt for input is not perfect.  Even the prompt for input was changed for improvement))) The best is the enemy of the good.

Re: Maximize all my forms

Hi Everyone,
I think we've all been guilty of trying to write something that is perfect rather than something that fits the requirement!
As the people who write the applications, we see the areas that we think might benefit from a little change here, a little change there - but to the end user, they probably wouldn't notice.
On the topic of enlarging your forms (rather than using 'maximise' which I think can rather unbalance a form), I remember you looking at 'scaleby' as a possibility but were concerned that you might not have covered all the possible variations of screen size, resolution etc.
As an option, rather than hard-coding your scaling factors in your script, you could always make it 'data-driven and use a 'scaleby' table (imaginatively named!) which should then allow for all possible combinations (please see the attached).
You can also hold tablegrid sizing in the same table (tablegrid row height doesn't work well with just 'scaleby'). 
And I should mention that as it's just a demo application, it doesn't have any error checking, so be sure that you
1.  don't set the scaleby too small or you can't read it!!
2.  you must only have one 'default' scaleby setting.
Anyway, maybe it gives you a couple of ideas.
Derek.

Post's attachments

Attachment icon scaleby4.zip 338.12 kb, 135 downloads since 2022-09-07 

14 (edited by papafrankc 2022-09-07 22:11:40)

Re: Maximize all my forms

Derek,
I've been looking over your example program and I don't see it doing anything?
I must not be understanding something??
Can you please explain how it works?
.
Thanks
Frank

Re: Maximize all my forms

Hi Frank,
If you refer to the screens (1-4) in the attachment.
1.  The program starts at whatever scaling was previously set.  Click on 'set-up'
2.  To alter the 'scale%', change the current 'default' from 'yes' to 'no'
3.  Choose a new scale% (a lower %age makes everything smaller, a higher %age makes everything larger)
4.  Restart the program and the new 'scale%' should now be active.
You can set up as many 'scale%' entries as you need and also adjust the default tablegrid row height (it's a bit 'trial and error' but once it's done, it's done).
Derek.

Post's attachments

Attachment icon frank resize.zip 134.96 kb, 145 downloads since 2022-09-08 

Re: Maximize all my forms

Derek,
I got it thanks.
Frank