On some of the windows in our current system, I force the focus to a particular control when the window opens by using the following code in the window’s internalFrameActivated event:def requestFocus(event=event):
import system
system.gui.getParentWindow(event).getComponentForPath('Root Container.controlName').requestFocusInWindow()
system.util.invokeLater(requestFocus)
This works well in every case except when I try to request the focus for a Text Area - this doesn’t seem to accept the focus.
The difference is probably that the text area is actually a scroll pane that holds a text area. Try this:
def requestFocus(event=event):
import system
textArea = system.gui.getParentWindow(event).getComponentForPath('Root Container.controlName')
textArea.viewport.view.requestFocusInWindow()
system.util.invokeLater(requestFocus)
Thanks Carl, that works perfectly.