right on time......... thanks... :p I was gonna work on this myself soon
I'll try this out later
On Dec 6, 2007 4:44 PM, Ken Dunnington <[EMAIL PROTECTED]> wrote:
> I needed my Tree control to only bring up the item editor when double
> clicked. I was going to post this as a question, but instead dug into it a
> bit more and came up with a solution, so I thought I'd share in case anyone
> else needs the same functionality (or has a better solution.)
>
> Basically, I'm listening for the itemEditBeginning event, canceling it,
> then manually setting the editedItemPosition on the itemDoubleClick event.
> Pretty simple, really, but if you're just getting into itemEditors (like me)
> hopefully this will be useful to you. Here's the relevant code:
>
> <mx:Script>
> <![CDATA[
> import mx.events.ListEvent;
> private function cancelSingleClickEditing(e:ListEvent):void {
> e.preventDefault();
> }
> // The ListEvent has the necessary rowIndex property needed to
> set editedItemPosition
> private function initiateDblClickEditing(e:ListEvent):void {
> var tree:Tree = Tree(e.currentTarget );
> tree.editedItemPosition = e;
> }
> ]]>
> </mx:Script>
>
> <mx:Tree id="MyTree" width="100%" height="100%" dataProvider="{
> model.MyList}"
> doubleClickEnabled="true" editable="true"
> itemDoubleClick="initiateDblClickEditing(event)"
> itemEditBeginning="cancelSingleClickEditing(event)"
> showRoot="false" labelField="@name" />
>
>