# Make window read only

**URL:** <https://forum.inductiveautomation.com/t/make-window-read-only/41399>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [December 10, 2020, 7:28pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399 "2020-12-10T19:28:56Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [December 10, 2020, 7:28pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/1 "2020-12-10T19:28:56Z")

</div>

Currently on 8.0.17 - Vision.

End user wants all clients to see everything, but only certain ones can control. I’ve done this in the past with ME, never Ignition. In ME I would blanket the window with a button of some kind, usually end key. It would be transparent and visible on whether the client is in the correct “zone” or not. Ignition acts the same way, I can blanket everything with a button and it will not allow any button presses. I can also use a text field which allows transparency, which is kind of cool However, these are clunky work arounds, ultimately I would like to place in a container and use enable, but no such property exists on a container. I don’t want to use security as this really isn’t role based.

Any other ideas to accomplish this? Any way to script the containers for enable?

---

<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:** [December 10, 2020, 8:26pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/2 "2020-12-10T20:26:47Z")

</div>

> [@jlandwerlen](#):
>
> End user wants all clients to see everything, but only certain ones can control.

Isn't that rather the epitome of role-based?

---

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [December 10, 2020, 8:28pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/3 "2020-12-10T20:28:56Z")

</div>

I hope this is in Perspective so the client can hit `Inspect Element` and delete the overlay in 0.3 seconds

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [December 10, 2020, 8:32pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/4 "2020-12-10T20:32:40Z")

</div>

> [@JordanCClark](#):
>
> > [@jlandwerlen](#):
> >
> > End user wants all clients to see everything, but only certain ones can control.
> 
> Isn't that rather the epitome of role-based?

No, this has nothing to do with the user, but where the client is located in regards to the process

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [December 10, 2020, 8:32pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/5 "2020-12-10T20:32:54Z")

</div>

Sorry, it’s Vision

---

<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:** [December 10, 2020, 8:33pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/6 "2020-12-10T20:33:14Z")

</div>

[Component and Window Security - Ignition User Manual 8.0 - Ignition Documentation (inductiveautomation.com)](https://docs.inductiveautomation.com/display/DOC80/Component+and+Window+Security)

---

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [December 10, 2020, 8:34pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/7 "2020-12-10T20:34:53Z")

</div>

Are multiple users logging in and out of these machines?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [December 10, 2020, 8:35pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/8 "2020-12-10T20:35:29Z")

</div>

Hostname

---

<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:** [December 10, 2020, 8:39pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/9 "2020-12-10T20:39:30Z")

</div>

I don’t understand why you wouldn’t use role-based security for this?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [December 10, 2020, 8:42pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/10 "2020-12-10T20:42:35Z")

</div>

Ok, help me understand how I would make it work for roles. This isn’t a situation where someone logs in or out and has the proper role(s). It’s they want specific touchscreens to do specific areas (the area they are in). So when the client boots I know the hostname and therefore I determine what they can and can’t do (the touchscreens, not the users). How do I pass this via security on components?

---

<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:** [December 10, 2020, 8:45pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/11 "2020-12-10T20:45:25Z")

</div>

Hmm, can you create user profiles according to the hostnames. Then in a startup script switch user according to hostname. The login would be invisible to the user, but then you have a user profile to set permissions for.

---

<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:** [December 10, 2020, 8:45pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/13 "2020-12-10T20:45:41Z")

</div>

I assume the project auto logs in. You can use [system.security.switchUser()](https://docs.inductiveautomation.com/display/DOC81/system.security.switchUser) to after the client loads to switch to an ‘authorized user’ for that spot of the process.

---

<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:** [December 10, 2020, 8:47pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/14 "2020-12-10T20:47:41Z")

</div>

> [@chasondeshotel](#):
>
> I would think using computer name would be more reliable and easier than hostname

Isn't that what hostname is?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [December 10, 2020, 9:00pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/16 "2020-12-10T21:00:28Z")

</div>

I didn’t need assistance with how to determine the client, but thanks for the info. It’s also not related to users or security. Maybe I will try a better way to explain later. For now I have a workaround. Thanks for the replies.

---

<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:** [December 10, 2020, 9:07pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/17 "2020-12-10T21:07:48Z")

</div>

> [@jlandwerlen](#):
>
> It’s also not related to users or security.

I understand where you're coming from, but Ignition really doesn't make that distinction. Even if it autologs in as an HMI, it's still a user. If an HMI location needs to control only a certain aspect of the process, it needs to be a different user (from Ignition's point of view).

* * *

Identifiers aside 🙄 Whether it's hostnames, IP addresses, or MACs, You can put something like this in the Client startup script to switch to an 'authorized user' for the location.

```python
locations = {'Hostname1':{'username':'user1', 'password':'pass1'},
             'Hostname2':{'username':'user2', 'password':'pass2'},
             'Hostname3':{'username':'user3', 'password':'pass3'}
            }

hostname = system.tag.readBlocking(['[System]Client/Network/Hostname'])[0].value

if hostname in locations.keys():
	system.security.switchUser(locations['hostname']['username'], locations['hostname']['password']

```

* * *

---

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [December 10, 2020, 9:13pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/18 "2020-12-10T21:13:21Z")

</div>

I always forget about those client tags

---

<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:** [December 10, 2020, 9:19pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/19 "2020-12-10T21:19:27Z")

</div>

Back to your original question:

Consider scripting around the window's Glass Pane. Similar to Kyle's solution to the Modal Window problem....

> [@Modal Pop-Up How-To?](http://forum.inductiveautomation.com/t/modal-pop-up-how-to/15211/10):
>
> Alright, who is ready for some hacking? This might get complicated, but here is how I have achieved this in the past. As an example, I will use my custom lock screen, attached in this post. Here is the script. def lockScreen(): from javax.swing import SwingUtilities,JFrame #Import some stuff import system.nav if system.util.getGlobals().has\_key('lockScreen'): #Check if the screen has been locked before. This really just saves the set up code system.util.getGlobals()["app"].getRootPane…

.... but adding a glass pane to the specific Vision Window, not the whole client application. No clicks will get through to the components of that window. Unfortunately, this is not available at the _container_ level.

Vision windows are type [FPMIWindow](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/factorypmi/application/FPMIWindow.html), which inherit from JInternalFrame, which is why they can have a glass pane layer above everything else.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [January 13, 2021, 4:53pm UTC](https://forum.inductiveautomation.com/t/make-window-read-only/41399/20 "2021-01-13T16:53:16Z")

</div>

To update my original question, I tried a few things, but I ended up using what I thought was the easiest, which is use a text field set as transparent and no border. I placed this code on the property change:

```auto
if event.propertyName == 'componentRunning' or event.propertyName == 'vision.bounds2d':
	if event.source.visible:
		container = event.source.parent
		container.setComponentZOrder(event.source,0)
		system.gui.transform(event.source, newX = 0, newY = 0, newWidth = container.width, newHeight = container.height)

```

This code will take care of size and z order. I created two custom properties, both integers. One is the current “zone”, the other is “zone” to allow write. When they are equal the component will go invisible.

I liked the modal idea, but then I had to fix navigation. This idea you just plop on the window and give it a “zone” setpoint and it just works.
