static void findAllFocusableComponents (Component* const parent, Array <Component*>& comps)
    {
        if (parent->getNumChildComponents() > 0)
        {
            Array <Component*> localComps;
            ScreenPositionComparator comparator;

            for (int i = parent->getNumChildComponents(); --i >= 0;)
            {
                Component* const c = parent->getChildComponent (i);

                if (c->isVisible() && c->isEnabled())
                    localComps.addSorted (comparator, c);
            }

            for (int i = 0; i < localComps.size(); ++i)
            {
                Component* const c = localComps.getUnchecked (i);

                if (c->getWantsKeyboardFocus())
                    comps.add (c);

                if (! c->isFocusContainer())
                    findAllFocusableComponents (c, comps);
            }
        }
    }
    static void findAllFocusableComponents (Component* parent, Array<Component*>& comps)
    {
        if (parent->getNumChildComponents() != 0)
        {
            Array<Component*> localComps;

            for (auto* c : parent->getChildren())
                if (c->isVisible() && c->isEnabled())
                    localComps.add (c);

            // This will sort so that they are ordered in terms of left-to-right
            // and then top-to-bottom.
            std::stable_sort (localComps.begin(), localComps.end(),
                              [] (const Component* a, const Component* b)
            {
                auto explicitOrder1 = getOrder (a);
                auto explicitOrder2 = getOrder (b);

                if (explicitOrder1 != explicitOrder2)
                    return explicitOrder1 < explicitOrder2;

                if (a->getY() != b->getY())
                    return a->getY() < b->getY();

                return a->getX() < b->getX();
            });

            for (auto* c : localComps)
            {
                if (c->getWantsKeyboardFocus())
                    comps.add (c);

                if (! c->isFocusContainer())
                    findAllFocusableComponents (c, comps);
            }
        }
    }