Adjust based on user resolution

Hey,

Just curious…I have an app using just the basic Xojo controls, Canvas, ImageWell, Labels, etc. I’m developing for the resolution 1366x768 (the most common res on laptops of the last year+ or so). But i’ve found a few users with older laptops whose max is 1280x800.

In Xojo, assuming the above conditions, is there a way to have the app “resize itself” to 1280x800 when first run and run at that res if the user is set to that and its their max resolution? What would be the code to do this, if so?

In the open event of your main window you can call me.Maximize to resize the window.

The minwidth and minheight properties of the window are the lower possible sizes.

Sure. Just check Screen(0).availablewidth and Screen(0).availableheight fr the dimensions of the main screen andsizevyour window accordingly.

I have some lines in there to always center the screen:

me.Left = (Screen(0).AvailableWidth-me.Width)/2 me.Top = (Screen(0).AvailableHeight-me.Height)/2

me.Maximize seems to mess up the display after I set it 1280x800 if I put it before these lines. I did set the min res to 1280x800 in the IDE.

From the docs:

Window.Maximize
Maximizes the window if it is not already maximized and calls the Maximize event handler. If the window was already maximized when you call this method, then it is restored to its prior state and calls the Restore event handler.

It has the same action like window maximize button. You do not need to position the window before you resize it to max window size. If you design the window with for example 600*400 and call window.maximize all should be happen automatically.

When I run the app at 1366x768 or higher all works fine.

I’m wanting the app to resize itself (and the controls inside) to 1280x800 if it detects that as the max on a user’s system. Do I need something like the ‘Elastic Window’ addon to do this easily?

Nope, take a look at the locking properties in the inspector

I started the application with the resolution 1600*900.
When I start it on the bigger screen, it is not filled to that screen capacity.
In case I use me.Maximize in Open event, it is filled fully in the bigger screen, however, my controls don’t become resized accordingly.
I mean the Window itself is resized to the full screen, but controls keep the same size.

I want those controls to be resized automatically according to the screen size(resolution).

Can you tell me if it is possible?

Check out Rubberviews.

It resizes all of the controls also to keep proportion to the window size.

[quote=192161:@Scott Siegrist]Check out Rubberviews.

It resizes all of the controls also to keep proportion to the window size.[/quote]

Thank you for the mention. Now RubberViews exists in two flavors, one for Desktop, and RubberViewsWE for the web.

You can check them out and download a complete functional evaluation project for each at RubberViews.com