<component name="TopMenu" extends="Group" initialFocus="foo1">
<children>
<LayoutGroup>
<Button id="foo1" text="Hello" />
<Button id="foo2" text="World" />
</LayoutGroup>
</children>
</component>
topMenu.setFocus(true)
topMenu.getChild(0).setFocus(true)
topMenu.getChild(0).getChild(0).setFocus(true)
Thank you so much i was stuck on this!
Oh, hilarious.. I saw this thread in the list and thought somebody had nicked my name. But it's my old account, from back when I didn't know anything!
So, I eventually progressed beyond the custom focus setter but I'm not sure the current approach is cleaner. As you can see, nobody contributed a good answer. 🙂
I ended up with a pretty messy solution involving observing 'focusedChild', and making use of .isInFocusChain(). I seem to recall you get a 'focusedChild' event in a component when you .setFocus() it, and then you can do a setFocus on the child component you want to actually be selected.
I'm afraid I abstracted it all away into code I no longer totally understand, but you at least have two avenues to investigate now.