I’m trying to do two things with an input textbox and a list component.
Firstly, I want to set the focus of a popup when it’s first opened to the input textbox. I’ve used the following code to do this, however the focus doesn’t seem to be the same as if you were to click on the component with the mouse. Instead, there is no orange “I’m selected!” border around it, and also, the cursor always appears at the front of the text when you type! I also can’t use the forward/back keys to visibly move position of the cursor (although it does move it around in the background, but a cursor still continues to flash directly in front of the typed text).
Code on Window internalFrameActivated event:
tboxFilter = system.gui.getParentWindow(event).getComponentForPath('Root Container.cntControl.tboxFilter') tboxFilter.requestFocusInWindow()
What’s going on here?
Secondly, the filter tbox above sets the filter in a WHERE clause SQL query for the List component beneath it. To make it easier for users to select an item, as we are all fond of shortcuts, I want them to be able to press the up and down arrow keys to select an item from the list. I’m able to do this by using the setSelectedIndex method on the List component, however changing the selected index does not move the viewport (the scrollbar) to the new position. Is there a function that I can use to do both of these actions together? Or do I need to set the scrollbar position myself?
One other solution is to simply set the focus to the List component, but I’d rather the textbox remain on focus. Also, when attempting this, I needed to set the list focus twice, once with grabFocus() or requestFocusInWindow(), and then again with nextFocus().
Thanks in advance