Automatically fit form to resolution

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
User avatar
gambafeliz
Posts: 139
Joined: Friday 2nd September 2022 7:50pm
Location: I live in the same city as Picasso

Automatically fit form to resolution

Post by gambafeliz »

Hello

I send you an example that depending on your resolution, you have to change the height of the window so that there is no going up or down. If they can't see it they will have to change the resolution to understand it.

My resolution for this example is 1600x1024

My question is, how can I start the application at a window size where the scroll bar does not exist?

It is possible that this is not well understood, I apologize if this is the case.

Thanks.
Attachments
demo.zip
(17.54 KiB) Downloaded 95 times
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
User avatar
thatbruce
Posts: 161
Joined: Saturday 4th September 2021 11:29pm

Re: Automatically fit form to resolution

Post by thatbruce »

Understood, and it's a good question.
Probably the answer lies in using MoveScaled in a Form_Open event handler.
There is a way to get the screen height but I can't find it at the moment. Maybe someone else can help here.
So what we want to do is use MoveScaled with x=0, y=0, height= the screen height and w=your design width.
BUT! This might not work too good if there is a top or bottom panel. :|
hth
b

p.s. or a possibly stupid easy way is just to maximise the form. i.e just set the FullScreen property to true in the form designer.
Have you ever noticed that software is never advertised using the adjective "spreadable".
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Automatically fit form to resolution

Post by BruceSteers »

I often have troubles with scrollview not being the size i expect it to be.

Question,, if you do not want the scroll bars then why use scrollview?

if you delete the scrollview container or change it into a scrollarea or a panel then the ContainerPanel works how you want it to and all fits in the screen. (see attached)

BruceS
Attachments
demo-0.0.1.tar.gz
(11.9 KiB) Downloaded 94 times
If at first you don't succeed , try doing something differently.
BruceS
User avatar
gambafeliz
Posts: 139
Joined: Friday 2nd September 2022 7:50pm
Location: I live in the same city as Picasso

Re: Automatically fit form to resolution

Post by gambafeliz »

Hello thatbruce and BruceSteers

My most sincere thanks. cool

Look at the first answer it has inspired me and thanks to it I think I have found the solution.

Regarding the second one, I appreciate it but ScrollView is there for an important reason. And it is to visualize let's say a very long vertical sheet as if it were a web. Therefore changing the design is for me a patch.

Young and not so young, I am going to give you my solution and in turn my proposal:

Code: Select all

' this is the solution for our case (FMain.Open)
Me.Height = Desktop.Height

Code: Select all

' this solution is in the case that there is an HBox1 at the top (FMain.Open)
Me.Height = Desktop.Height - HBox1.Height
I hope you agree and if not please tell me a much better idea. Thank you very much
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Post Reply