Google for examples.  Maybe Peter Ent's blog.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Annette Spooner
Sent: Friday, April 18, 2008 4:53 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Tabbing in custom item editor in datagrid

 

I have a datagrid, with a custom item editor that contains two text
input fields. When the user tabs into the column using this tem editor,
I would like focus to be set on the first text field. Tabbing again
should move focus to the second text field and tabbing a third time
should move focus out of the custom item editor and on to the next
column. Is this possible in Flex 2?

 

My custom item editor (see code below) implements the
IDropInListItemRenderer and the IFocusManagerComponent classes. I gather
I have to create and activate a new focus manager instance when the
component is created, and deactivate the focus manager for the main
application. But I do not know how to access the focus manager for the
main application. Is there anything else I should be doing as well? Do I
have to set focusEnabled, tabEnabled or tabChildren, or will the default
values be sufficient? And how do I decide when to destroy the item
editor and move focus back to the main application?

 

Thanks in advance for your help.

Annette

 

 

<?xml version="1.0" encoding="utf-8"?>

                 

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"; 

                height="100%" width="100%" 

                paddingBottom="0" paddingLeft="0" paddingRight="0"
paddingTop="0"

                horizontalScrollPolicy="off"

                creationComplete="initRenderer()"

 
implements="mx.controls.listClasses.IDropInListItemRenderer,
mx.managers.IFocusManagerComponent">

                

                <mx:Script>

                                <![CDATA[

                                                import
mx.controls.listClasses.ListData;

                                                import
mx.controls.dataGridClasses.DataGridListData;

                                                 import
mx.controls.listClasses.BaseListData;

                                                 import
mx.controls.dataGridClasses.DataGridItemRenderer

                                                import
mx.managers.IFocusManager;

                                                import
mx.managers.FocusManager;

                                                import
mx.controls.Alert;

                                                

                                                [Bindable] public var
actionValue:Object;                        // Property for returning the
new value to the cell 

                                                [Bindable] public var
progressValue:Object;           // Property for returning the new value
to the cell 

 

                                                private var
_fm:FocusManager;

                                                 private var
_listData:DataGridListData;

 


                                                public function
initRenderer(): void

                                                {

                                                                _fm =
new FocusManager(this);

 
_fm.activate();

 
action.setFocus();

                                                }

 

                                                 override public
function get data():Object 

                                                {

                                                                 return
super.data;

                                                }            

 

                                                override public function
set data(value:Object):void 

                                                {

                                                                if
(value.actions[_listData.dataField] != null)

                                                                {

 
action.text = String(value.actions[_listData.dataField]);

 
progress.text = String(value.progress[_listData.dataField]);

                                                                }

                                                                else

                                                                {

 
action.text = "";

 
progress.text = "";

                                                                }

                                                 } 

                                                

                                                public function get
listData():BaseListData

                                                {

                                                                return
_listData;

                                                 }

 

                                                 public function set
listData(value:BaseListData):void

                                                 {

 
_listData = DataGridListData(value);

                                                }   

                                                

                                                // Implement the
drawFocus() method for the VBox.

                                                 override public
function drawFocus(draw:Boolean):void 

                                                {

 
action.setFocus();

                                                }

 

                                ]]>

                </mx:Script>      

                                

                <mx:Binding destination="actionValue"
source="action.text"/>

                <mx:Binding destination="progressValue"
source="progress.text"/>

                

                <mx:TextInput id="action"/>

                <mx:TextInput id="progress"/>

</mx:VBox>

 

No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.23.1/1384 - Release Date:
17/04/2008 3:47 PM

 

Reply via email to