I know this might be trivial for you guys, but how do I set the value of a label to the value of a power table cell on double click? Also, where can I find a list of scripting functions? Thanks.
As for this…
If the table and the label are at the same level, just add the following to the OnDoubleClick extension function of the table.
self.parent.getComponent('Label').text = value
This will take the value that is double clicked on, and write it to the text property of the label component named “Label”.
Ctrl+J will open the Component Scripting window, FYI.
Thanks, this is what I tried and didn’t work
event.source.parent.getComponent('Label').text = value
There is no event object in the extension functions, you must use self instead.
Compare your script to the one posted by Stuart. Stuarts script should work.
It did, I was just showing him what I had tried before I posted the question
Another Extension Function question:
system.gui.getParentWindow(event) be used in an extension function?
window = system.gui.getParentWindow(event) value = window.getRootContainer().customProperty
No, because there is no event object in extension functions. Use self instead.
window = system.gui.getParentWindow(self) value = window.getRootContainer().customProperty
am i doing something wrong, self is not a EventObject.
Is there otherway to get the rootcontainer without to write self.parent.parent… and so on
Java’s SwingUtilities can help. Place the following in a script module,
from javax.swing import SwingUtilities from com.inductiveautomation.factorypmi.application import FPMIWindow def getParentWindow(component): return SwingUtilities.getAncestorOfClass(FPMIWindow, component)
Then in your extension function, you can do:
w = shared.swing.getParentWindow(self) v = w.rootContainer.customProperty