views:

248

answers:

2

Hi,

I am getting problem in accessing the control inside a component. The scenario is I have a datagrid in which I have a component in which I have a textarea. Now by selecting a menu option I need to focus the textarea. Pls help me in referring the textarea. I need to setfocus in that textarea.

Thanks in advance.

A: 

You can say

myDataGrid.editedItemPosition = {rowIndex:4, columnIndex:1};
myDataGrid.editedItemRenderer.myTextArea.text = "blah";

That will probably only work if your component is set as the itemEditor and not the itemRenderer.

rogueg
A: 

Thanks for replying.

But I am using itemRenderer only.

And now I have textflow instead of textarea. And I am not able to get focus to the cell. I tried this:

var fcs:IFocusManagerComponent = focusManager.getFocus();
if(fcs is TextFlow)
{    
 var txt:String = TextFlow(fcs).getCharAtPosition(0);;
 trace(txt);
}

I got this from flex edit menu operations on multiple textareas

I am calling this code on a button click. So I am getting fcs as Button object. Instead I need to get focus on datagrid's cell's itemrenderer TextFlow. How can I achieve it?

related questions