# Dynamically Change Stroke Style

**URL:** <https://forum.inductiveautomation.com/t/dynamically-change-stroke-style/10769>\
**Category:** General Discussion\
**Created:** [November 10, 2015, 3:51pm UTC](https://forum.inductiveautomation.com/t/dynamically-change-stroke-style/10769 "2015-11-10T15:51:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tebright1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tebright1/32/87405_2.png) [@tebright1](https://forum.inductiveautomation.com/u/tebright1)\
**Post date:** [November 10, 2015, 3:51pm UTC](https://forum.inductiveautomation.com/t/dynamically-change-stroke-style/10769/1 "2015-11-10T15:51:30Z")

</div>

Is it possible to set up an expression to adjust the Stroke Style on the fly? It allows you to enter an expression. Not sure what output it is looking for. Thanks.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [November 10, 2015, 5:19pm UTC](https://forum.inductiveautomation.com/t/dynamically-change-stroke-style/10769/2 "2015-11-10T17:19:47Z")

</div>

You can either use runscript to bring back a BasicStrokeStyle or create a custom property on the component for StrokeWidth.

[code]from java.awt import BasicStroke

if event.propertyName == “StrokeWidth”:  
event.source.strokeStyle = BasicStroke(event.newValue)[/code]

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 10, 2015, 5:47pm UTC](https://forum.inductiveautomation.com/t/dynamically-change-stroke-style/10769/3 "2015-11-10T17:47:40Z")

</div>

I posted [a demo](https://inductiveautomation.com/forum/viewtopic.php?p=51495#p51495) on this a while back. Hope this helps!
