Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

Ctrl+c in Adobe AIR

$
0
0

Hi,

 

I have an advanceddatagrid with selectionMode="multipleCells". When i select few cells using ctrl key and then copy the content using Ctrl+c, the cells are getting deselected automatically and the content is not getting copied. Can someone help on this. Attaching part of my code.

 

private

 

 

var _ctrlHoldFlag:Boolean = false;

 

 

privatefunction myKeyDownHandler(event:KeyboardEvent):void {

 

     if (event.ctrlKey) {

          _ctrlHoldFlag =

true;

     }

}

 

privatefunction myKeyUpHandler(event:KeyboardEvent):void

{

     var

 

 

keycode_c:uint = 67;

 

     var keycode_v:uint = 86;

 

     var keycode_x:uint = 88;

     if

 

 

(_ctrlHoldFlag && (event.keyCode == keycode_c || event.keyCode == keycode_v || event.keyCode == keycode_x))

     {

          event.preventDefault();

 

          if(event.keyCode == keycode_c) {

               copyData(event.currentTarget);

 

 

          }

     }

     if

 

 

(event.ctrlKey) {

          _ctrlHoldFlag =

false;

     }

 

}

 

public

 

 

function copyData(objCurrentTarget:Object):void {

 

     var dataString="';

     var

 

n1:int = objCurrentTarget.selectedCells.length;

(Note://The value of n1 is coming as zero and hence the content is not getting copied.)

 

     for (var iCount:int = 0; iCount < n1; iCount++)

     {

 

          var cell:Object = objCurrentTarget.selectedCells[iCount];

 

          var data:Object = objCurrentTarget.dataProvider[cell.rowIndex];

 

 

          var dataField:String = objCurrentTarget.columns[cell.columnIndex].dataField;

          if(dataString != "') {

               dataString = dataString + "|"+ data[dataField];

 

          }

     }

}

              

     

Thanks in advance.


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>