Jump to content
weabow

MultiDisplay : choose specific display on boot

Recommended Posts

Hi there,

 

Closing myapp, I save in the ini the current screen with :

Screen.DisplayFromForm(self).Index (self is mainform).

 

It runs fine.

 

I'd like on boot to display the app on the same screen, using my Screen.DisplayFromForm(self).Index saved.

 

I can't see anywhere how to do that.


An idea ?

 

Share this post


Link to post

You cannot directly set a specific display. Instead you position the form so that it is shown on the desired display.

Share this post


Link to post

Thanks.

 

I tried to set Self.Left := -10000; but the form stays on the main screen.

Share this post


Link to post

It works as expected when I place the following code in FormCreate:

  var displayIndex := Screen.DisplayCount - 1;
  var display := Screen.Displays[displayIndex];
  SetBoundsF(display.Workarea.Left, display.Workarea.Top, Width, Height);

 

  • Like 1

Share this post


Link to post

Best to remember position instead of displaynumber (and windowmode (maximized or not)).

You also want to check if the position you set your form on still is visible, user could have disconnect a display for instance., so you can make sure your app is visible on startup.

 

 

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

×