MapView.CreateWithSize
----------------------

Creates a new map view inside the window with the given rectangle.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [MapView](component_MapView.md) | [9.0](newinversion90.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "MapView.CreateWithSize"; WindowRef; X; Y; W; H ) 

**MBS**( **"MapView.CreateWithSize";** /\* Creates a new map view inside the window with the given rectangle. \*/  
**$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 \*/   
**$X**; /\* The left coordinate in the window.e.g. 0 \*/   
**$Y**; /\* The top coordinate in the window.e.g. 0 \*/   
**$W**; /\* The width of the image view in the window.e.g. 100 \*/   
**$H**) /\* The height of the image view in the window.e.g. 100 \*/ 

### 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 |
| X | The left coordinate in the window. | 0 |
| Y | The top coordinate in the window. | 0 |
| W | The width of the image view in the window. | 100 |
| H | The height of the image view in the window. | 100 |

### Result

Returns map view reference number or error.

### Description

Creates a new map view inside the window with the given rectangle.  
Use [MapView.Release](MapViewRelease.md) later to destroy the image view.  
  
If you use a register (tab controls) on the window, be aware that the image view actually is in front of the register (tab controls). So you need to check in the script which register page is current and should show what image view. Or by a trigger you turn the visibility on and off.  
  
Image view reference numbers are starting at 78000 and counting up for each new map view.  
  
Not supported for MacOS 32-bit.  
Does not work for Web Direct.  
### See also

- [ImageView.CreateWithSize](ImageViewCreateWithSize.md)
- [MapView.Release](MapViewRelease.md)
- [TextView.CreateWithSize](TextViewCreateWithSize.md)
- [Window.FindByIndex](WindowFindByIndex.md)
- [Window.FindByTitle](WindowFindByTitle.md)

### Example Databases

- [Mac and iOS/MapKit/MapView](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/MapKit/MapView.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 11 - Know Your Way](https://www.mbsplugins.de/archive/2024-12-11/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin Advent calendar: 20 - MapView](https://www.mbsplugins.de/archive/2023-12-20/MBS_Plugin_Advent_calendar_20_/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 14th January 2019 , last changed 19th February 2021

  
[MapView.CreateWithControl](MapViewCreateWithControl.md) - [MapView.FormatDistance](MapViewFormatDistance.md)

[HTML Version](MapViewCreateWithSize.shtml)