# MessageBox on a Dropdown List component

**URL:** <https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [May 16, 2025, 12:16pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329 "2025-05-16T12:16:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Filarm27](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Filarm27](https://forum.inductiveautomation.com/u/Filarm27)\
**Post date:** [May 16, 2025, 12:16pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/1 "2025-05-16T12:16:31Z")

</div>

Hi everyone,

I have a dropdown list component with two possible choices. When the selection in the dropdown is changed, I have a script running on the `propertyChange` event that writes a value to a tag.

Immediately after this tag write occurs, I would like to display a message box to confirm that the value has been successfully written.

My current script for the `propertyChange` event is simple. Could someone please guide me on how to display a message box using system.gui.messageBox?

```python
if event.source.selectedValue == 1:
	system.tag.writeBlocking("MyTagPath", 100)
		
elif event.source.selectedValue == 2:
	system.tag.writeBlocking("MyTagPath", 200)
	

```

If I insert system.gui.message Box immediately after the 'IF', it's being fired by the proprerty change and so the confirmation message continues to be displayed. And not only once the choice has been changed.

Thanks everyone.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 16, 2025, 12:27pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/2 "2025-05-16T12:27:02Z")

</div>

You need to add a filter to the propertyChange script. The dropdown has many properties that can change, and any of them can fire the event.

```python
if event.propertyName == 'selectedValue':
    # do something

```

Secondly, why don't you bind the tag value to the selectedValue of the dropdown? With bi-direction selected, the tag writes are automatic, no scripting needed.

---

<div class="post-metadata">

**Author:** ![Filarm27](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Filarm27](https://forum.inductiveautomation.com/u/Filarm27)\
**Post date:** [May 16, 2025, 12:33pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/3 "2025-05-16T12:33:03Z")

</div>

it works! thanks a lot! 🙏

I don't bind the tag value to the selectedValue of the dropdown because I need to write a float value and the selected value of the component is integer

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 16, 2025, 3:29pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/4 "2025-05-16T15:29:18Z")

</div>

If it's always the same tag, i'd create a custom property and bi-directionally bind it to the tag.  
Then write to that property when the dropdown selection change,  
and add another change script to open your message box when the custom prop changes.

edit:  
Actually... I missed the part in @dkhayes117 's answer that said to bind the tag to the dropdown's value.  
That's probably a better approach.

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [May 16, 2025, 5:56pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/5 "2025-05-16T17:56:11Z")

</div>

bind a derived tag with a float/int conversion for writeexpression and readexpression?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 16, 2025, 7:32pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/6 "2025-05-16T19:32:57Z")

</div>

Make the value a float then.

If you're pulling it from a database, cast the value to float in the query.  
If you're building it with a script, cast it there.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 16, 2025, 10:18pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/7 "2025-05-16T22:18:04Z")

</div>

Vision's combobox only supports integer for the actual `selected value` property.

In this case, it doesn't matter though (since OP's example script was using `100` and `200`) - you could just send those as integers and they'll be coerced in the binding/tag system to the closest float value anyways.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 16, 2025, 10:25pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/8 "2025-05-16T22:25:59Z")

</div>

> [@paul-griffith](#):
>
> Vision's combobox only supports integer for the actual `selected value` property.

Really ? It's been so long since I've used vision...  
But why, though ?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 16, 2025, 10:30pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/9 "2025-05-16T22:30:16Z")

</div>

At this point, the answer is lost to time. It probably made sense at one point as an easy default, and it's never been worth the risk/complexity to make it smarter. Vision's core components are, for better or worse, pretty consistent about sticking to a single core numeric Java type for properties - that's why the spinner has separate `double` and `integer` values: [Vision - Spinner | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/components/vision-components/input/spinner)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 16, 2025, 10:56pm UTC](https://forum.inductiveautomation.com/t/messagebox-on-a-dropdown-list-component/106329/10 "2025-05-16T22:56:53Z")

</div>

There's no common supertype that would cover all of the data type possibilities, so a chameleon property would have to take `java.lang.Object`. That has negative consequences all over the place. Makes my head hurt.
