Screen.Width
------------

Queries screen width.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Screenshot](component_Screenshot.md) | [1.0](newinversion10.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "Screen.Width"; ScreenID { ; Unit } ) 

**MBS**( **"Screen.Width";** /\* Queries screen width. \*/  
**$ScreenID**; /\* The zero based index of the screen to to target.e.g. 0 \*/   
**$Unit**) /\* Optional; Can be point or pixel or empty.  
Default is pixel on Windows and point on macOS/iOS.e.g. "Point" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| ScreenID | The zero based index of the screen to to target. | 0 |  |
| Unit | Can be point or pixel or empty.   Default is pixel on Windows and point on macOS/iOS. | "Point" | Optional      Added in version **15.0**. |

### Description

Queries screen width.  
FileMaker's built in functions for returning related information only works for the "desktop" and may include more than one screen in a Multiple monitor situation.   
  
For version 7.1 we added support for multiple monitors for Windows.  
### Examples

Get the first screen's co-ordinates

 MBS ( "[Screen.Left](ScreenLeft.md)" ; 0 ) &amp; "' " &amp;  
MBS ( "[Screen.Top](ScreenTop.md)" ; 0 ) &amp; "' " &amp;  
MBS ( "Screen.Width" ; 0 ) &amp; "' " &amp;  
MBS ( "[Screen.Height](ScreenHeight.md)" ; 0 )  
Figure out on which screen the first window is:

 Let(\[  
 WindowCenterX = MBS ( "[Window.GetLeft](WindowGetLeft.md)"; 0 ) + MBS ( "[Window.GetWidth](WindowGetWidth.md)"; 0 );  
 WindowCenterY = MBS ( "[Window.GetTop](WindowGetTop.md)"; 0 ) + MBS ( "[Window.GetHeight](WindowGetHeight.md)"; 0 );  
 $ScreenIndex = -1;  
  
 r = While (   
 \[   
 c = MBS ( "[Screen.Count](ScreenCount.md)" );   
 i = 0   
 \] ;   
 i &lt; c ;   
 \[   
 l = MBS ( "[Screen.Left](ScreenLeft.md)"; i );  
 t = MBS ( "[Screen.Top](ScreenTop.md)"; i );  
 w = MBS ( "Screen.Width"; i );  
 h = MBS ( "[Screen.Height](ScreenHeight.md)"; i );  
 $ScreenIndex = If(   
 (l ≤ WindowCenterX) AND   
 (t ≤ WindowCenterY) AND   
 (WindowCenterX ≤ l + w) AND   
 (WindowCenterY ≤ t + h) ; i; $ScreenIndex );   
 i = i + 1 \] ; 0 )  
  
\]; $ScreenIndex )  
### See also

- [Screen.Count](ScreenCount.md)
- [Screen.Height](ScreenHeight.md)
- [Screen.Left](ScreenLeft.md)
- [Screen.Top](ScreenTop.md)
- [Window.GetHeight](WindowGetHeight.md)
- [Window.GetLeft](WindowGetLeft.md)
- [Window.GetTop](WindowGetTop.md)
- [Window.GetWidth](WindowGetWidth.md)

### Release notes

- **Version 15.0**
    - Added Unit parameter to [Screen.Height](https://www.mbsplugins.eu/ScreenHeight.shtml), [Screen.Left](https://www.mbsplugins.eu/ScreenLeft.shtml), [Screen.Top](https://www.mbsplugins.eu/ScreenTop.shtml) and [Screen.Width](https://www.mbsplugins.eu/ScreenWidth.shtml) functions.

### Example Databases

- [Overlay](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Overlay.shtml#12ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 14.6pr1](https://www.mbsplugins.de/archive/2024-12-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Add a WebViewer to an Overlay window](https://www.mbsplugins.de/archive/2024-11-13/Add_a_WebViewer_to_an_Overlay_/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 22nd November 2024

  
[Screen.Top](ScreenTop.md) - [Screenshot](Screenshot.md)

[HTML Version](ScreenWidth.shtml)