1 Reply Latest reply on May 10, 2010 9:35 PM by Flex harUI

    Special characters into datagrid through the use of buttons

    Doctor Panga



      I have a datagrid for word input, I'm trying to create a "special characters" panel, kind of like google's new "virtual keyboard" thing on google.com, so that the user can enter data into the datagrid cells using characters that aren't on their keyboards.


      I manage to do this just fine, using the solution below. I know this is probably not the best/most effective way to do this, so any suggestions for making the code better will be appreciated. I only started using Flex a month ago.


      grid.addEventListener(DataGridEvent.ITEM_EDIT_BEGIN, selectColumn)



      function selectColumn(event:DataGridEvent):void


      var selectedColumn:DataGridColumn = grid.columns[event.columnIndex];

      selCol = selectedColumn.dataField;





      //The function for adding a special character to the selected datagrid column by clicking a button:

      //(inputWordArray is the dataprovider for the grid called "grid" )



      protected function clickSomeButton(event:MouseEvent):void


      var colIndex:int = new int;


      if (selCol == "from"){

      inputWordArray[grid.selectedIndex].from = inputWordArray[grid.selectedIndex].from + "æ";

      colIndex = 0;


      else if (selCol == "to"){

      colIndex = 1;

      inputWordArray[grid.selectedIndex].to = inputWordArray[grid.selectedIndex].to + "æ";





      grid.dispatchEvent(new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, false, colIndex, null, grid.selectedIndex));







      The problem is that this only adds a letter at the end of the selected item's value, not at a specific position within the word specified by the position of the cursor. This is what I need to achieve. I have no idea even what to search for, if anyone could please give me a hint that'd be great.