Maybe ComboBox editor creation is slow enough and the TABs come fast enough that tabbing leaves the DG and goes out to the Browser. Logging what events you are getting might help you see what is going on (KEY_DOWN, KEY_FOCUS_CHANGE, FOCUS_IN, FOCUS_OUT, ITEM_EDIT_*)
Alex Harui Flex SDK Developer Adobe Systems Inc. Blog: http://blogs.adobe.com/aharui -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Andriy Panas Sent: Thursday, April 23, 2009 12:07 PM To: [email protected] Subject: Re: [flexcomponents] Why Flex's Datagrid component is listening for Event.DEACTIVATE event? Hi Alex, Thanks for the response. No, I do not press mouse button and TAB button simultaneously. I only press TAB button and do not release it. My use case is as follows: -------------------------------------- We emulate complex data entry form by using DataGrid and multiple itemEditors. Some DataGrid cells are not editable (like form labels), some are editable (form entry fields). If the user wants to quickly navigate between edited cells in Datagrid, that he or she will press TAB button and will not release it (too lazy to press it multiple times) - it will allow him (her) to move tab index by keyboard in the quickest fashion possible. It works flawlessly if the itemEditor is based around <mx:TextInput>, but with <mx:Combobox> inside itemEditors it is not that fluent UI experience which we would like to achieve. -------------------------------------- -- Best regards, Andriy Panas 2009/4/23 Alex Harui <[email protected]>: > > > If you TAB while the mouse is down, I'm not sure what our code will do. The > player may send focus to the browser and then you'll get a deactivate > event. These problems are hard to debug because even going to the debugger > causes a DEACTIVATE event. > > > > Alex Harui > > Flex SDK Developer > > Adobe Systems Inc. > > Blog: http://blogs.adobe.com/aharui > > > > From: [email protected] [mailto:[email protected]] > On Behalf Of D > Sent: Thursday, April 23, 2009 9:25 AM > To: [email protected] > Subject: Re: [flexcomponents] Why Flex's Datagrid component is listening for > Event.DEACTIVATE event? > > > > > I hope this will give you a better picture: > > > > Just run it: > > > > > > > > > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > layout="vertical" > > verticalAlign="middle" > > backgroundColor="white" > > creationComplete="onCreationComplete()"> > > <mx:Script> > > <![CDATA[ > > import mx.controls.Alert; > > > > private function onCreationComplete() : void > > { > > trace("on Creation Complete"); > > systemManager.addEventListener(Event.DEACTIVATE, > > onDeactivate); > > > > systemManager.addEventListener(Event.ACTIVATE, > > onActivate); > > > > } > > > > > > private function onActivate(event : Event) : void > > { > > trace("Event.ACTIVATE is CAlled now"); > > } > > > > private function onDeactivate(event : Event) : void > > { > > trace("Event.DEACTIVE is fired for some reason"); > > } > > ]]> > > </mx:Script> > > > > </mx:Application> > > > > > ------- > Thanks & Regards, > D > > > On Thu, Apr 23, 2009 at 11:52 AM, Andriy Panas <[email protected]> wrote: > > > > Hi Alex, > > I understand what is the meaning of Event.DEACTIVATE event. > > What I do not understand is why Event.DEACTIVATE is dispatched by > Flash player when the following example is run. > > <------------code starts---------------> > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="vertical" > verticalAlign="middle" > backgroundColor="white" > creationComplete="onCreationComplete()"> > <mx:Script> > <![CDATA[ > import mx.controls.Alert; > > private function onCreationComplete() : void > { > systemManager.addEventListener(Event.DEACTIVATE, > onDeactivate, false, 0, true); > > } > > private function onDeactivate(event : Event) : void > { > trace("Event.DEACTIVE is fired for some reason") > } > ]]> > </mx:Script> > <mx:ArrayCollection id="arrColl"> > <mx:source> > <mx:Array> > <mx:Object label="Student A" score="10" /> > <mx:Object label="Student B" score="20" /> > <mx:Object label="Student C" score="30" /> > <mx:Object label="Student D" score="50" /> > <mx:Object label="Student A" score="10" /> > <mx:Object label="Student B" score="20" /> > <mx:Object label="Student C" score="30" /> > <mx:Object label="Student D" score="50" /> > </mx:Array> > </mx:source> > </mx:ArrayCollection> > <mx:DataGrid > editable="true" > width="100%" > height="200" > dataProvider="{arrColl}"> > <mx:columns> > <mx:DataGridColumn id="column1" > dataField="label" > editorDataField="value"> > <mx:itemEditor> > <mx:Component> > <mx:ComboBox> > <mx:dataProvider> > <mx:String>Student A</mx:String> > <mx:String>Student B</mx:String> > <mx:String>Student C</mx:String> > <mx:String>Student D</mx:String> > </mx:dataProvider> > </mx:ComboBox> > </mx:Component> > </mx:itemEditor> > > </mx:DataGridColumn> > </mx:columns> > </mx:DataGrid> > </mx:Application> > > <-------code ends------------------> > > I enter the Datagrid's first row item editor (which is Combobox > with editable="false") and then hit TAB key instantly without > releasing. > > By doing so I witness that "onDeactivate" event handler is fired > every time I move via keyboard tabbing to a new itemEditor. > > -- > Best regards, > Andriy Panas > > 2009/4/20 Alex Harui <[email protected]>: > >> >> >> DEACTIVATE is used to detect that the browser or some other application is >> taking focus so we close any editor that may be up. > > > > ------------------------------------ Yahoo! Groups Links
