DragDrop.AttachToWindow
-----------------------

Attaches a new drop area to the window.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DragDrop](component_DragDrop.md) | [11.0](newinversion110.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "DragDrop.AttachToWindow"; WindowRef ) 

**MBS**( **"DragDrop.AttachToWindow";** /\* Attaches a new drop area to the window. \*/  
**$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 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| 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 |

### Result

Returns overlay reference number or error.

### Description

Attaches a new drop area to the window.  
This disables FileMaker's drop handler and installs the plugin one to the window.  
You can't assign a picture or change position on Windows.  
  
On MacOS calls [DragDrop.CreateWithWindow](DragDropCreateWithWindow.md) internally.  
You may need to release via [DragDrop.Release](DragDropRelease.md) later, especially when switching layouts.  
  
Be sure to release this when leaving layout or switching to a different window mode. Otherwise you can't drag &amp; drop controls within the layout editor.  
### Examples

Attach to window of the FileMaker solution:

 # SetupDrop attach in file DragTest drag   
  
\# let FileMaker build the layout   
Pause/Resume Script \[ Duration (seconds): ,1 \]   
\# now add our control   
Set Variable \[ $$dropview ; Value: MBS ("DragDrop.AttachToWindow"; Get(WindowName) ) \]   
Set Variable \[ $result ; Value: MBS ( "[DragDrop.RegisterDropTypes](DragDropRegisterDropTypes.md)"; $$dropview ; "file") \]   
Set Variable \[ $result ; Value: MBS ( "[DragDrop.SetDragActionHandler](DragDropSetDragActionHandler.md)"; $$dropview ; Get ( FileName ); "DragAction") \]   
Set Variable \[ $result ; Value: MBS ( "[DragDrop.SetCursor](DragDropSetCursor.md)"; $$dropview ; 1) \]  
### See also

- [DragDrop.CreateWithWindow](DragDropCreateWithWindow.md)
- [DragDrop.RegisterDropTypes](DragDropRegisterDropTypes.md)
- [DragDrop.Release](DragDropRelease.md)
- [DragDrop.SetCursor](DragDropSetCursor.md)
- [DragDrop.SetDragActionHandler](DragDropSetDragActionHandler.md)
- [DragDrop.SetFilePathsToDrag](DragDropSetFilePathsToDrag.md)
- [VersionAutoUpdate](VersionAutoUpdate.md)
- [Window.FindByIndex](WindowFindByIndex.md)
- [Window.FindByTitle](WindowFindByTitle.md)

### Release notes

- **Version 11.2**
    - Deprecated [DragDrop.CreateWithWindow](https://www.mbsplugins.eu/DragDropCreateWithWindow.shtml) in favor of [DragDrop.AttachToWindow](https://www.mbsplugins.eu/DragDropAttachToWindow.shtml) function.
- **Version 11.0**
    - Added [DragDrop.AttachToWindow](https://www.mbsplugins.eu/DragDropAttachToWindow.shtml) function to allow drop to whole window on Windows.

### Example Databases

- [Drag and Drop/DragTest](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Drag%20and%20Drop/DragTest.shtml#10ScriptAnchor_)
- [Drag and Drop/for Mac/DragTest multiple picture files](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Drag%20and%20Drop/for%20Mac/DragTest%20multiple%20picture%20files.shtml#5ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 11.2pr4](https://www.mbsplugins.de/archive/2021-04-21/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Seven things to add to your FileMaker solution today with MBS Plugin](https://www.mbsplugins.de/archive/2021-03-21/Seven_things_to_add_to_your_Fi/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 11.0](https://www.mbsplugins.de/archive/2021-01-26/New_in_MBS_FileMaker_Plugin_11/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 11.0](https://www.mbsplugins.de/archive/2021-01-19/Neues_MBS_FileMaker_Plugin_110/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 11.0 - More than 6400 Functions In One Plugin](https://www.mbsplugins.de/archive/2021-01-19/MBS_FileMaker_Plugin_110_-_Mor/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.6pr1](https://www.mbsplugins.de/archive/2020-12-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 25th November 2020 , last changed 20th January 2025

  
[DragDrop.AttachToOverlay](DragDropAttachToOverlay.md) - [DragDrop.ClearDragActionHandler](DragDropClearDragActionHandler.md)

[HTML Version](DragDropAttachToWindow.shtml)