# Try custom Dialogs for Tiled scripting

**URL:** <https://discourse.mapeditor.org/t/try-custom-dialogs-for-tiled-scripting/5659>\
**Category:** Development\
**Created:** [June 15, 2022, 3:05pm UTC](https://discourse.mapeditor.org/t/try-custom-dialogs-for-tiled-scripting/5659 "2022-06-15T15:05:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dogboydog](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/dogboydog/32/3572_2.png) [@dogboydog](https://discourse.mapeditor.org/u/dogboydog)\
**Post date:** [June 15, 2022, 3:05pm UTC](https://discourse.mapeditor.org/t/try-custom-dialogs-for-tiled-scripting/5659/1 "2022-06-15T15:05:16Z")

</div>

Hello,

I’m looking to get some feedback and testers for a new scripting feature that I’m trying to introduce.

Dialogs follow the user’s configured theme, and allow scripts to get multiple pieces of information at once, while attempting to automatically create a visually pleasing layout for all of the widgets you add to the dialog.

Screenshots:  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/mapeditor/original/2X/4/44d5cd25943809a2b27c7a9e4c14b23c7303c68d.png)  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/mapeditor/original/2X/8/8f240483cbb28a78d3b8fd365b6a7cc0c41614cd.png)  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/mapeditor/original/2X/2/2e75b7ac6fdf327c112519edf705dfa2dbe2dd67.png)

I think this could help introduce some very interesting and user-friendly scripts.

Note: this feature is a work in progress. The API might change based on feedback.

The pull request where I’m tracking which features are implemented and which are not:

> <https://github.com/mapeditor/tiled/pull/3384>
>
> Allow a customizable dialog to be created via scripting as requested in #3001. A…llows script writers to get more pieces of information from the user. The dialogs can be persistent or you can connect to a signal such as \`finished()\` and only move on with your script after a dialog is closed. 
> 
> Goals: 
> 
> \- \[x\] Label (just a plain bit of text, used to label other widgets, but this should be separate rather than forced on each widget, as sometimes the label itself can be used for output, or to label groups of related widgets). Also allows multiline text -- just include \\n in your label text and specify maxWidth = true. 
> \- \[x\] Text input 
> \- \[\] Text browser (allows rendering HTML) not yet implemented
> \- \[x\] Separator (with optional text, for labelling sections) addSeparator()
> \- \[x\] Slider (returns a value between 0 and 1 inclusive, or perhaps takes min/max/step parameters) addSlider()
> \- \[x\] Dropdown: addComboBox()
> \- \[x\] Checkbox: addCheckBox()
> \- \[x\] dialog.clear(): Now working
> 
> 
> \- \[\] File selector (lets the user select a file path, any actual opening/parsing/writing would be done by the script). Not yet implemented.
> \- \[x\] Color like the Color properties in Tiled, shows a color's hex value, a preview of it, and allows selecting a new color by opening a Select Color modal)
> \- \[\] Main Tiled documentation about this feature
> \- \[\] Typescript doc (partially completed) 
> 
> Stretch goals:
> 
> \* addImage(): add an image to the dialog which can be updated
> \* Ability to disable automatic grouping of same-type widgets so that you can mix widget types in some cases
> Example scripts to use this functionality:
> https://github.com/dogboydog/tiled-dialog-scripts

Example scripts:

> **[GitHub - dogboydog/tiled-dialog-scripts: Scripts demonstrating the Dialog...](https://github.com/dogboydog/tiled-dialog-scripts)**
>
> Scripts demonstrating the Dialog functionality in Tiled - GitHub - dogboydog/tiled-dialog-scripts: Scripts demonstrating the Dialog functionality in Tiled

Current download link:

> <https://github.com/mapeditor/tiled/actions/runs/2505917947>

^ Scroll down and pick the download for your operating system. I’d recommend downloading the standalone builds like Tiled-win64 for Windows rather than the .msi installer so that it doesn’t overwrite your installed version of Tiled. You will need to log in with a GitHub account (free for anyone to create) to download the builds.

---

<div class="post-metadata">

**Author:** ![dogboydog](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/dogboydog/32/3572_2.png) [@dogboydog](https://discourse.mapeditor.org/u/dogboydog)\
**Post date:** [June 16, 2022, 8:21pm UTC](https://discourse.mapeditor.org/t/try-custom-dialogs-for-tiled-scripting/5659/2 "2022-06-16T20:21:45Z")

</div>

New version available for download:

> <https://github.com/mapeditor/tiled/actions/runs/2512291568>

You can now use addFilePicker() and addTextInput()

Examples still here:

> **[GitHub - dogboydog/tiled-dialog-scripts: Scripts demonstrating the Dialog...](https://github.com/dogboydog/tiled-dialog-scripts)**
>
> Scripts demonstrating the Dialog functionality in Tiled - GitHub - dogboydog/tiled-dialog-scripts: Scripts demonstrating the Dialog functionality in Tiled

---

<div class="post-metadata">

**Author:** ![dogboydog](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/dogboydog/32/3572_2.png) [@dogboydog](https://discourse.mapeditor.org/u/dogboydog)\
**Post date:** [June 19, 2022, 9:20pm UTC](https://discourse.mapeditor.org/t/try-custom-dialogs-for-tiled-scripting/5659/3 "2022-06-19T21:20:12Z")

</div>

New download link:

> <https://github.com/mapeditor/tiled/actions/runs/2525190252>

You can now add images to your dialog  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/mapeditor/original/2X/1/1d27b1c00de5abdbbe65a91663a496ab90d4fdbc.png)

---

<div class="post-metadata">

**Author:** ![dogboydog](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/dogboydog/32/3572_2.png) [@dogboydog](https://discourse.mapeditor.org/u/dogboydog)\
**Post date:** [June 22, 2022, 3:55pm UTC](https://discourse.mapeditor.org/t/try-custom-dialogs-for-tiled-scripting/5659/4 "2022-06-22T15:55:52Z")

</div>

Updated download with bug fixes:

> <https://github.com/mapeditor/tiled/actions/runs/2542612433>
