DEACTIVATE is used to detect that the browser or some other application is taking focus so we close any editor that may be up.
Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: [email protected] [mailto:[email protected]] On Behalf Of Andriy Panas Sent: Monday, April 20, 2009 6:28 AM To: [email protected] Subject: [flexcomponents] Why Flex's Datagrid component is listening for Event.DEACTIVATE event? Dear all, In line 4780 of DataGrid.as source code from Flex 3.2 SDK the author of the code subscribes to Event.DEACTIVATE event inside private method "itemEditorItemEditBeginHandler". ----------------------------------------- line 4780: systemManager.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true); ----------------------------------------- Why DataGrid "wants" to listen to this specific event Event.DEACTIVATE that is dispatched from the core of the Flash Player? I am wondering , because when I use custom renderer that is based on Combobox control as itemEditor of DataGrid's column, then I often lose the focus from itemEditor to the DataGrid itself when I am tabbing between itemEditor instances by pressing keyboard TAB key (I press TAB key and do not release it for a little while). During my tabbing sequence between itemEditors in Datagrid suddenly Event.DEACTIVATE is triggered by Flash player and then DataGrid's event listener 'deactivateHandler' function code is executed which moves the focus away from itemEditor to datagrid == in UI it results as flickering focus from itemEditor to Datagrid and back. The code 'deactivateHandler' function follows: ----------------------------------------- line 4568: private function deactivateHandler(event:Event):void line 4569: { .... : // if stage losing activation, set focus to DG so when we get it back // we popup an editor again if (itemEditorInstance) { endEdit(DataGridEventReason.OTHER); losingFocus = true; setFocus(); } } ----------------------------------------- -- Best regards, JabbyPanda
