1 Reply Latest reply on Nov 20, 2007 2:05 PM by Jank Rod

    Click-edit behavior of List-container items


      Sorry if it has been asked, but I couldnt find it. I would like to know if it is possible to start editing an item in a List-container when a user double-clicks. With default settings it starts editing on a single click. I couldnt find anything in the documentation. How can I change this behaviour?

      Also, is it possible to set the focus on a List-container item in edit mode? What I mean is that I could implement a double-click event-handler that changes the List-conatiner from not-editable to editable and then put the double-clicked item in edit-mode. Is this possible? Than I could implement my desired double-click-edit behaviour easily.

      Thank you!
        • 1. Re: Click-edit behavior of List-container items
          Jank Rod

          I was trying to find an answer to the same issue. I never found anything in the documentation either. After walking through the Tree and List class a bit I came up with this. Here is an example where the Tree is not editable and double clicking a node will allow you to rename it.

          tree.addEventListener( ListEvent.ITEM_DOUBLE_CLICK, itemDoubleClick );
          tree.addEventListener( ListEvent.ITEM_EDIT_END, itemEditEnd );

          private function itemDoubleClick( event:ListEvent=null ):void
          tree.editable = true;
          tree.editedItemPosition = {rowIndex:tree.selectedIndex};
          private function itemEditEnd( event:ListEvent=null ):void
          tree.editable = false;

          - Jankrod