[Bug] Perspective events not working?

I’ve created a button, added an onClick event, added a Script action. The action body is just system.gui.messageBox(“foo”). In my client, clicking the button does nothing. I’ve also tried with onChange and onMouseDown. I’ve also tried just having the script add 1 to a numeric field.

Ignition 8.0.0-beta0 (b2018120302), Chrome and also iOS 11.3/iPhone 7.

The system.gui functions are only for Vision, I believe. So system.gui.messageBox() doesn’t exist in Perspective.

1 Like

@mrogers is correct.

While scripting in Perspective or Vision, if you use the Ctrl-Space shortcut to view available functions, you’ll be able to see what is available in your current context. Since you are in Perspective, then system.gui.* is not available. If you were encountering this in Vision, then we would sound an alarm.

As has been explained to me, if you examine the documentation and look into individual functions, if the “Scope” is declared as “Gateway”, then it can be used in Perspective OR Vision. If the “Scope” is “Client”, then it can only be used in Vision.

1 Like

We actually recently changed the manual to hopefully be a little more clear. Each function now lists where it can be used out of the Gateway, a Vision Client, or a Perspective Session.

Also keep in mind that shared and project script modules can be called from all of these scopes, and therefore (are supposed to) show all script functions. Some functions won’t be present based on the caller’s scope.

1 Like

In restrospect, it makes some sense that messageBox() might not be available in Perspective. And I got my other test script working after realizing I was trying to use props.text when I should have been using props.value. I also just noticed that a Perspective script that his an error like this puts an error in the log on the gateway, which is nice.

It would be nice if a message would display in the Designer if a script does not compile, as currently happens in 7.x.

I have the same problem with system.tag.write
This does not update the tag with the new value.
I have it also on a button with an onclick event

also an expression with a tag doesn’t work properly.
when i write the following:

if({MaandagTestTag} = 1,‘true’,‘not true’)

I get the same result as this:

if({MaandagTestTag} = 0,‘true’,‘not true’)

It points too a boolean tag.
Both expressions give me the result: ‘not true’

I think there is a bug in the tag systems.
tag.write doesn’t work at all in scripting.

Try casting your constants with the toBoolean() expression function.

I don’t get any response to Ctl-space in Perspective event or script windows. So is there a list of Perspective script functions available? I did not see that in the manual. Thanks…


You can find any of the functions in the reference section at the end. Remember that both the software and manual are still in beta, so things may be missing and/or incomplete. I know there are more perspective functions that we haven’t had a chance to add.

To be honest, I was just trying to get some kind of feedback from Perspective action scripts on what info it was returning. In Vision I might have thrown a system.gui.messageBox(str(returnthing)), or did a print to console. How do I get even this basic function in Perspective?

Use a logger from system.util.getLogger(). The output will show in the gateway logs.

1 Like

Thanks Phil, I will give that a try.

Even I am facing the same problem with the onclick event configuration.
The script perfectly works fine when applied on a Button component but not for a Numeric Filed.