this simple PR improves usability of the part selection window by focusing immediately on the correct control.
Without this, a user must press a key prior to actually using it: press one key to focus, then one or more keys to make selection. This is silly, so focus programmatically!
It sounds like the the default control focus is not set in the skin. We prefer not to override it in the code unless absolutely necessary, as it restricts what skinners can do.
DialogFileStacking.xml already sets the default control to 450 - but it doesn't work. I think this is because the list control isn't loaded at the time we try to set focus inside the gui framework.
This fix sets the focus after the list is loaded, and is not contradicting the skin settings.
I would say therefore it is still valid, no?
No, it's not valid, as the skinner doesn't have the opportunity to set it elsewhere should they wish (not that they do most of the time, but sometimes they have good reasons for doing so).
The correct fix would be to fill the list in the appropriate spot so that the default control selection functions.
@jmarshallnz - I have looked into where the list gets filled but I don't see how that can be changed or anything. I have made another change - see updated commit - that also seems to fix the issue.
Somehow, the list lost focus (I know, because I traced and it gets focus earlier). Then GUIWindow::DoProcess tries to give the default control focus if nothing else has already focus. That fails because the code is badly written (it only checks that the currently focused control CANNOT focus - it does not check that currently focused control is NULL...)
I think this was a bug, and I'm pretty sure this has no impact on other windows/dialogs.
That's not a bug, that's by design. Consider touch or mouse input where nothing has focus.
It doesn't happen in media windows, it's just this one. Thus, there's a difference. Find the difference and you'll find the problem :)
[gui] set focus immediately to avoid repeated keypress
Thanks for the hint. I looked at DialogSelect, and applied the same logic. This time it works. Hopefully you like this better :-)
Looks good :-)