Overlay.SetFrameWithControl
---------------------------

Sets the size and position of the overlay based on a given control.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Overlay](component_Overlay.md) | [14.1](newinversion141.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Overlay.SetFrameWithControl"; OverlayRef; WindowRef; ControlName { ; DX; DY; DWidth; DHeight } ) 

**MBS**( **"Overlay.SetFrameWithControl";** /\* Sets the size and position of the overlay based on a given control. \*/  
**$OverlayRef**; /\* The overlay window reference number.e.g. $overlay \*/   
**$WindowRef**; /\* Window Reference is the unique OS level window ID.   
You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window.e.g. 0 \*/   
**$ControlName**; /\* The name of the control on your FileMaker form.   
e.g. you can place a rectangle there to define the position.e.g. "mymedia" \*/   
**$DX**; /\* Optional; A delta to move overlay more to left or right.e.g. 0 \*/   
**$DY**; /\* Optional; A delta to move overlay more to top or bottom.e.g. 0 \*/   
**$DWidth**; /\* Optional; extra width to add.e.g. 0 \*/   
**$DHeight**) /\* Optional; Extra height to adde.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| OverlayRef | The overlay window reference number. | $overlay |  |
| WindowRef | Window Reference is the unique OS level window ID.    You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window. | 0 |  |
| ControlName | The name of the control on your FileMaker form.    e.g. you can place a rectangle there to define the position. | "mymedia" |  |
| DX | A delta to move overlay more to left or right. | 0 | Optional |
| DY | A delta to move overlay more to top or bottom. | 0 | Optional |
| DWidth | extra width to add. | 0 | Optional |
| DHeight | Extra height to add | 0 | Optional |

### Result

Returns OK or error.

### Description

Sets the size and position of the overlay based on a given control.  
Convenient method to place an overlay next to a FileMaker control, e.g. with a help text.  
### Examples

Set frame based on control:

 Set Variable \[ $r ; Value: MBS ("Overlay.SetFrameWithControl"; $$overlay ; 0; "info") \]  
### See also

- [AVPlayer.SetFrameWithControl](AVPlayerSetFrameWithControl.md)
- [DragDrop.SetFrameWithControl](DragDropSetFrameWithControl.md)
- [ImageView.SetFrameWithControl](ImageViewSetFrameWithControl.md)
- [MapView.SetFrameWithControl](MapViewSetFrameWithControl.md)
- [Overlay.SetFrame](OverlaySetFrame.md)
- [Preview.SetFrameWithControl](PreviewSetFrameWithControl.md)
- [TextView.SetFrameWithControl](TextViewSetFrameWithControl.md)
- [WebView.SetFrameWithControl](WebViewSetFrameWithControl.md)
- [Window.FindByIndex](WindowFindByIndex.md)
- [Window.FindByTitle](WindowFindByTitle.md)

### Example Databases

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

### Blog Entries

- [New in MBS FileMaker Plugin 14.1](https://www.mbsplugins.de/archive/2024-03-19/New_in_MBS_FileMaker_Plugin_14/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2025, Seite 30](https://filemaker-magazin.de/neuigkeit/4297-Appetithappen-FMM_202504)

Created 22nd January 2024 , last changed 24th January 2024

  
[Overlay.SetFrame](OverlaySetFrame.md) - [Overlay.SetHasShadow](OverlaySetHasShadow.md)

[HTML Version](OverlaySetFrameWithControl.shtml)