RE: [flexcoders] Re: Problem with focus in secondary popups
The Flex Framework has some built-in functionality around popups. In general, you should not need to call FocusManager.activate() or SystemManager.activate() unless you are in some unexpected scenario. I modified your example and it seemed to work correctly for me. Here are the changes I made: SimplePopUp.mxml private function fClose():void { PopUpManager.removePopUp(this); if (m_pParent is CMyPanel) { // CMyPanel(m_pParent).fSetFocus(); } } CMyPanel.as public function fSetFocus():void { PopUpManager.centerPopUp(this); //var fm:FocusManager = new FocusManager(this); //fm.activate(); //fm.setFocus(m_InitialFocus as IFocusManagerComponent); m_InitialFocus.setFocus(); //fm.showFocus(); //systemManager.activate(this); m_bFocused = true; } -Alex From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dmitri Girski Sent: Wednesday, February 20, 2008 3:16 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Problem with focus in secondary popups Hi Alex, I have created a simple test case: http://mitek.id.au/TestPopUpSimple.html http://mitek.id.au/TestPopUpSimple.html Source: http://mitek.id.au/PopupFocus.zip http://mitek.id.au/PopupFocus.zip http://mitek.id.au/CMyPanel.as http://mitek.id.au/CMyPanel.as - is the base class for the popup window - it performs all the focusing stuff. Actually this class can focusing without any problem BUT only if popups are created automatically in one go. As soon as you use button clicks to create popups - TAB focus is stuck in the first one and it won't be restored ever. Even if you close all popups and start it over again. NB updateComplete listener - is not essential in this particular case, but I need in because I use my own caching popupmanager where popups are reused and then creationComplete won't be dispatched for them http://mitek.id.au/SimplePopUp.mxml http://mitek.id.au/SimplePopUp.mxml - derived from CMyPanel - just handles 2 buttons - New and Close http://mitek.id.au/TestPopUpSimple.mxml http://mitek.id.au/TestPopUpSimple.mxml - main app. Just run it, then press New and then press TAB - cursor will move in the first popup, but selection will be in the second popup. Could you please have a look at this problem? Thanks! Dmitri. --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Alex Harui [EMAIL PROTECTED] wrote: systemManager.activate
RE: [flexcoders] Re: Problem with focus in secondary popups
systemManager.activate From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dmitri Girski Sent: Tuesday, February 19, 2008 7:31 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Problem with focus in secondary popups Hi guys, it's me again. Still with my boring focus problem. Ralf reflexactions - I've learnt how to place focus in the control in the popup. But bloody hell - the TAB focus is still in the parent popup. So, if I subscribe for ESC key in the third popup - everything is OK, everybody is happy. But if I press TAB - it just goes in the popup underneath. PS Due to the Flex memory leaks/perfomance issues/garbage collector laziness I've created the caching popup manager which worsen the problem. Popup is being created only once and then it will be reused. So instead of creationComplete event in the reused popup I am listening for updateComplete events and you will be surprised that setting focus methods are different for existing windows. Does anyone know how to set TAB focus as well? Thanks, Dmitri --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , reflexactions [EMAIL PROTECTED] wrote: Yep thats what we do. --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Ralf Bokelberg ralf.bokelberg@ wrote: You could dispatch a close event to the view, which opened the popup Cheers Ralf. On Sat, Feb 16, 2008 at 1:38 PM, Dmitri Girski mitek17@ wrote: Thank you, Alex and reflexactions! Your advices helped to move forward I can create popups and set focus without a problem. But there is another thing - I have to return focus correctly to the first popup window after second third popups closed in one click. Cheers, Dmitri. -- Ralf Bokelberg ralf.bokelberg@ Flex Flash Consultant based in Cologne/Germany
Re: [flexcoders] Re: Problem with focus in secondary popups
You could dispatch a close event to the view, which opened the popup Cheers Ralf. On Sat, Feb 16, 2008 at 1:38 PM, Dmitri Girski [EMAIL PROTECTED] wrote: Thank you, Alex and reflexactions! Your advices helped to move forward I can create popups and set focus without a problem. But there is another thing - I have to return focus correctly to the first popup window after second third popups closed in one click. Cheers, Dmitri. -- Ralf Bokelberg [EMAIL PROTECTED] Flex Flash Consultant based in Cologne/Germany