# isTouchscreenModeEnabled not working when project launched

**URL:** <https://forum.inductiveautomation.com/t/istouchscreenmodeenabled-not-working-when-project-launched/7320>\
**Category:** Ignition\
**Created:** [September 25, 2013, 3:09pm UTC](https://forum.inductiveautomation.com/t/istouchscreenmodeenabled-not-working-when-project-launched/7320 "2013-09-25T15:09:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [September 25, 2013, 3:09pm UTC](https://forum.inductiveautomation.com/t/istouchscreenmodeenabled-not-working-when-project-launched/7320/1 "2013-09-25T15:09:35Z")

</div>

I am using isTouchscreenModeEnabled which works fine in preview mode is the Designer. However, when the project is launched my conditional logic that is fired in preview mode is no longer executed.

I am toggling the project to touchscreen mode when logging in, and touching on textboxes is properly displaying the on-screen keyboards as expected. So any ideas why the isTouchscreenModeEnabled function would not be returning True with a launched project?

Thanks,  
Bob

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [September 25, 2013, 6:18pm UTC](https://forum.inductiveautomation.com/t/istouchscreenmodeenabled-not-working-when-project-launched/7320/2 "2013-09-25T18:18:17Z")

</div>

Well this functionality works for me, what version of Ignition are you using? What makes you think that your script isn’t working? What/where is your script being run?

---

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [September 25, 2013, 6:43pm UTC](https://forum.inductiveautomation.com/t/istouchscreenmodeenabled-not-working-when-project-launched/7320/3 "2013-09-25T18:43:26Z")

</div>

This is the script in the mouseReleased of a Button. I am getting the passwordBox when the project is launched and not the messageBox. It works fine in preview.

`if system.gui.isTouchscreenModeEnabled():
	system.gui.messageBox("You must re-enter the administrator user password.", "Password Confirmation")
	password= system.gui.showTouchscreenKeyboard("",24,1)
else:
	password= system.gui.passwordBox("Confirm Password")`

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [September 25, 2013, 7:00pm UTC](https://forum.inductiveautomation.com/t/istouchscreenmodeenabled-not-working-when-project-launched/7320/4 "2013-09-25T19:00:20Z")

</div>

That looks pretty straightforward to me. Are there any other event scripts on that button? I’ve used an expression to test the current state.`runScript("system.gui.isTouchscreenModeEnabled()",1000)`

---

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [September 25, 2013, 7:41pm UTC](https://forum.inductiveautomation.com/t/istouchscreenmodeenabled-not-working-when-project-launched/7320/5 "2013-09-25T19:41:49Z")

</div>

Oh wow, bad mistake on my part. A different container was being displayed when launched due to another parameter setting. So I was not actually pressing the same Button during preview as I was when launched. After figuring this out, all is fine.

Thank you for your assistance, but my apologies for taking your time.

Bob
