# onDoubleClick Extension Function

**URL:** <https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961>\
**Category:** Ignition\
**Created:** [May 8, 2018, 3:36pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961 "2018-05-08T15:36:44Z")\
**Posts on this page:** 10\
**Page:** 1

<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:** [May 8, 2018, 3:36pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/1 "2018-05-08T15:36:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://forum.inductiveautomation.com/u/Stuart)\
**Post date:** [May 8, 2018, 4:08pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/2 "2018-05-08T16:08:21Z")

</div>

> [@dkhayes117](#):
>
> Also, where can I find a list of scripting functions?

[Take a look at the Extension Function section for Power Tables in the manual.](https://docs.inductiveautomation.com/display/DOC79/Power+Table)

---

<div class="post-metadata">

**Author:** ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://forum.inductiveautomation.com/u/Stuart)\
**Post date:** [May 8, 2018, 4:20pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/3 "2018-05-08T16:20:22Z")

</div>

> [@dkhayes117](#):
>
> how do I set the value of a label to the value of a power table cell on double click?

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.

---

<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:** [May 8, 2018, 5:00pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/4 "2018-05-08T17:00:42Z")

</div>

> [@Stuart](#):
>
> self.parent.getComponent('Label').text = value

Thanks, this is what I tried and didn't work

```auto
event.source.parent.getComponent('Label').text = value 
```

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [May 8, 2018, 6:15pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/5 "2018-05-08T18:15:41Z")

</div>

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.

---

<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:** [May 8, 2018, 6:16pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/6 "2018-05-08T18:16:53Z")

</div>

It did, I was just showing him what I had tried before I posted the question

---

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [February 28, 2020, 4:52pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/7 "2020-02-28T16:52:36Z")

</div>

Another Extension Function question:  
Can `system.gui.getParentWindow(event)` be used in an extension function?  
Such as:

```auto
	window = system.gui.getParentWindow(event)
	value = window.getRootContainer().customProperty

```

---

<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:** [February 28, 2020, 5:10pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/8 "2020-02-28T17:10:49Z")

</div>

No, because there is no **event** object in extension functions. Use **self** instead.

```python
	window = system.gui.getParentWindow(self)
	value = window.getRootContainer().customProperty
```

---

<div class="post-metadata">

**Author:** ![roland.scheuer](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@roland.scheuer](https://forum.inductiveautomation.com/u/roland.scheuer)\
**Post date:** [March 19, 2020, 9:24am UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/9 "2020-03-19T09:24:14Z")

</div>

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 🙂

---

<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:** [March 19, 2020, 12:14pm UTC](https://forum.inductiveautomation.com/t/ondoubleclick-extension-function/17961/10 "2020-03-19T12:14:03Z")

</div>

Java’s [SwingUtilities](https://docs.oracle.com/javase/8/docs/api/javax/swing/SwingUtilities.html#getAncestorOfClass-java.lang.Class-java.awt.Component-) can help. Place the following in a script module, `shared.swing`, perhaps:

```auto
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:

```auto
w = shared.swing.getParentWindow(self)
v = w.rootContainer.customProperty

```
