Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ScriptUI: Are there ways to mimic a treeview node doubleclick?

Enthusiast ,
Jun 14, 2013 Jun 14, 2013

Hi!

Is there a way to mimic a double click on a node in a ScriptUI Treeview?

I find no suitable event on the Treeview or on the Listitem (node) objects.

Are there workarounds for this?

Just thinking out loud:

Could a Listitem (node) be located, from the coordinates of the mouse move event?

Is it possible to put other objects than ListItems inside the treeview – on top of the active list item in the TreeView.onChange event – just to get a better set of events?

Other ways...?

Best regards,

Andreas

TOPICS
Scripting
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 15, 2013 Jun 15, 2013

Andreas,

Nodes can be used for double-click without any problem. That is to say, you check if the tree has been double-clicked, then you check what in the trees was clicked. Something like this:

myTree.onDoubleClick = doSomething;

function doSomething{

   if (/*some valid selection*/){

      . . .

      . . .

   }

}

Locating a list item from the coordinates of a move mouse event would be very difficult I guess.

Peter

Message was edited by: PK

Translate
Community Expert ,
Jun 15, 2013 Jun 15, 2013

Andreas,

Nodes can be used for double-click without any problem. That is to say, you check if the tree has been double-clicked, then you check what in the trees was clicked. Something like this:

myTree.onDoubleClick = doSomething;

function doSomething{

   if (/*some valid selection*/){

      . . .

      . . .

   }

}

Locating a list item from the coordinates of a move mouse event would be very difficult I guess.

Peter

Message was edited by: PK

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 17, 2013 Jun 17, 2013

Thanks Peter, you are perfectly right!

I must have looked at the node (listitem) only, when I checked for an onDoubleClick event on objects by reflection, since it's obviously there, when I check the TreeView today:

>this

Result: [object TreeView]

>this.reflect.methods

Result: onExpand,onDoubleClick,removeAll,....

Also, I was probably tricked into believing that the treeview lacked this event,

from page 81 in the JavaScript Tools Guide for CS6 (it seemed to me that listbox was the only one of the three similar controls that had the double click event):

* ListBox, DropDownList, and TreeView controls generate events whenever the selection in the list

changes. To handle the event, define a callback function for onChange. The TreeView control also

generates events when the user expands or collapses a node, handled by the onExpand and

onCollapse callback functions.

* The ListBox also generates an event when the user double-clicks an item. To handle it, define a callback function for the onDoubleClick event.

Best regards,

Andreas

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 10, 2014 Dec 10, 2014
LATEST

I have written a dynamic treeview that creates tree items based on a set of scripts in a given folder. It works fine if I use single click access on a selected node, but I wanted to create a double click function. However, I have noticed that the double click function I created in Extendscript works fine when I run it in that environment, but when it is run in AFX cs6, the doubleclick does not work.

myOnDoubleClick = function(event)

                        {

                            if(event.detail ==  2)

                            {

                                var script = (event.target.selection.text);

                                if (event.target.selection.text  !==  "my AFX Scripts") {runSelectedScript(script); }

                                else if(event.target.selection.text  ===  "my AFX Scripts") {cantRunThis();  }

                            }

                        }           

                       myAFXScriptPanel.grp.groupOne.myMultiTreeView.addEventListener('click', myOnDoubleClick);

//END OF SCRIPT

runSelectedScript(script) is a function that takes the selected item text and concatenates it with a path and extension and then executes the script. As stated, works fine in Extendscript environment, but will not function in After Effects. The other function (cantRunThis) just creates an alert if the top node of the tree is selected.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines