Some time back I created my Sliding Panel component and did a demo of it here.
The problem with this component as it stands is that the focus goes around all the focusable components, including those on the sliding panel. In other words, you can tab around the TextInput controls on the main forms, and then focus will disappear off onto the TextInput controls on the sliding panel, even if it’s closed. What is really required is a separate focus loop around the components in the sliding panel.
I started off just by creating a new instance of FocusManager and pointing it at the SlidingPanel instance. That solution suffered from two problems:
- Firstly whilst focus would correctly move around all the components within the sliding panel, focus in the parent form would also include the components in the panel. This wasn’t really a surprise as the FocusManager in the parent form will just go right ahead and include all the focusable component that it finds in its children, which will include those in the sliding panel.
- Secondly, I hit a big bug in SystemManager. I just clicked on a TextInput in the sliding panel and the app crashed in SystemManager::mouseDownHandler(), on the line:
index = childList.getChildIndex(p);
The code in SystemManager assumes that all the members of the forms collection are either pop-ups or direct children of the SystemManager instance. My new FocusManager automatically added itself to the forms collection, but it was somewhere in the middle of the display list, not a pop-up of child of the SystemManager. So I had to fix this issue, and for now I’ve just put that whole section of code in a try/catch block so that it survives the call to childList.getChildIndex(p).
The next problem to solve was that focus in the main form continued around all the controls in the sliding panel. This was relatively easy to fix just by setting the tabChildren property of the SlidingPanel class to false. This meant that the FocusManager handling the main form stopped adding any focusable components within the sliding panel.
However, this had a major side-effect – the FocusManager handling the components contained in the sliding panel didn’t work at all. The reason was that in addFocusables() there was a call to isTabVisible() which searches up the display list to see if any parent objects have tabChildren set to false. Of course, this spotted that SlidingPanel had its tabChildren property set to false and concluded that all its children should be ignored for tabbing. So I had to create my own SlidingPanelFocusManager which didn’t perform that test.
The end result is here. You can tab around the 6 TextInput controls and focus won’t enter any of the sliding panels. If you open a panel, however, focus will move around the controls within the panel, including the button to open or close the panel. It all works, but the number of changes to the mx framework mean that it won’t see production for a while until I make sure that there aren’t any more side effects.



