Make window read only

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?

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

2 Likes

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

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

Sorry, it’s Vision

Component and Window Security - Ignition User Manual 8.0 - Ignition Documentation (inductiveautomation.com)

Are multiple users logging in and out of these machines?

Hostname

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

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?

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.

I assume the project auto logs in. You can use system.security.switchUser() to after the client loads to switch to an ‘authorized user’ for that spot of the process.

2 Likes

Isn't that what hostname is?

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.

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 :roll_eyes: 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.

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']

1 Like

I always forget about those client tags

Back to your original question:

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

.... 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, which inherit from JInternalFrame, which is why they can have a glass pane layer above everything else.

1 Like

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:

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.