Is there any documentation on the methods associated with component event properties? For example, in a problem solved on another thread, the solution used a method:
“event.source.putClientProperty(‘singleClick’, True)” where ‘singleClick’ was an event property and ‘True’ was the value to set it to.
There was also a similar “getClientProperty” method. I cannot find references to these methods by searching in the user manual. I also wonder what other methods might be available. These were not custom methods. I was able to use them in my script as written. I appreciate it if anyone can help me find any lists or documentation that may exist about these methods.
The method putClientProperty
adds a new property to the component it’s called on. In this instance, @witman was adding a property called singleClick
to the button component and setting its value to true
.
So singleClick
was an added custom property. putClientProperty
and getClientProperty
are methods available to objects that inherit from the javax.swing.JComponent
class.
The javadocs will show you what methods and properties are available to all Ignition classes, but these all inherit from standard Java and Java Swing which you’ll need to view their own documentation to see more details.
You’ll need to know the object type that you’re trying to see the methods/properties for, and in Python you can use type(...)
E.g.
print type(event.source)
> <type 'com.inductiveautomation.factorypmi.application.FPMIWindow'>
Then search for the last element FPMIWindow
in the javadocs
As a side note, you can actually add python function objects themselves to Ignition windows using the putClientProperty
which is sometimes useful.
3 Likes
OK. Thanks. I will check it out.
I edited the example script as it was missing the print statement, fyi
Could you please elaborate on the last sentence?
As a side note, you can actually add python function objects themselves to Ignition windows using the putClientProperty which is sometimes useful.
Maybe if you have some code example or additional information, that'd be great! I'm struggling with very similar problem and this would help me a lot. Thank you!