# MultiScreen positioning with Separate Spaces for screens?

**URL:** <https://forum.xojo.com/t/multiscreen-positioning-with-separate-spaces-for-screens/76884>\
**Category:** macOS\
**Created:** [August 14, 2023, 12:53am UTC](https://forum.xojo.com/t/multiscreen-positioning-with-separate-spaces-for-screens/76884 "2023-08-14T00:53:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KarenA](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@KarenA](https://forum.xojo.com/u/KarenA)\
**Post date:** [August 14, 2023, 12:53am UTC](https://forum.xojo.com/t/multiscreen-positioning-with-separate-spaces-for-screens/76884/1 "2023-08-14T00:53:35Z")

</div>

I want to be able to position windows on different screens (I have 3)… Does Xojo have a built in way of handling that when “Displays have Separate Spaces” is turned on?

The code below displays all 3 windows on the main screen… Which makes sense sort of… but I can manually drag windows between the different screens

If there is a way to address each space to place a Window on a specific screen in this case, I would also need a way to find out which “space” an existing window is in…

This is API 1 code but looking at the docs I don’t see anything different for API 2 :

```auto
Dim W as Window1

For i as Integer = ScreenCount -1 DownTo 0
  W = New Window1
  W.Title = "Screen " + str(i)
  W.Left = Screen(i).Left
next

```

Thanks,  
-Karen

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [August 14, 2023, 2:24pm UTC](https://forum.xojo.com/t/multiscreen-positioning-with-separate-spaces-for-screens/76884/2 "2023-08-14T14:24:48Z")

</div>

API2 equivalent of your code is this, not sure about spaces though:

```auto
For iDisplay As Integer = 0 To DesktopDisplay.LastDisplayIndex

  W = New Window1
  W.Title = "Screen " + str( iDisplay )
  W.Left = DesktopDisplay.DisplayAt( iDisplay ).Left
  
Next

```

---

<div class="post-metadata">

**Author:** ![KarenA](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@KarenA](https://forum.xojo.com/u/KarenA)\
**Post date:** [August 14, 2023, 4:04pm UTC](https://forum.xojo.com/t/multiscreen-positioning-with-separate-spaces-for-screens/76884/3 "2023-08-14T16:04:02Z")

</div>

> [@Ian\_Kennedy](#):
>
> not sure about spaces though

API 2 code would not make a difference…

I believe Xojo’s API assumes that the X values are continuous across all screens, which is not the case when the user has activated the MacOS “Spaces” feature.

I don’t know if there is a way (outside of perhaps declares) of placing a window on a specific screen or detecting which screen a window is on when the spaces feature is active.

- Karen

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [August 14, 2023, 4:34pm UTC](https://forum.xojo.com/t/multiscreen-positioning-with-separate-spaces-for-screens/76884/4 "2023-08-14T16:34:27Z")

</div>

I didn’t really expect it would. Both APIs deal with real display devices whereas Spaces are a virtual layer on top of those. I suspect your only hope is declares. Stage Manager will likely throw another layer into the mix.
