HI, I have several UI windows that I’m using for settings adjustments.
Everything is working well and the documentation is easy to apply.
However, I’m not able to figure out how to focus on and bring a window to the front via code. I’m using Lua. When I click on the window, it focuses automatically. But I can’t figure out how to push this with a line of code. The way I set up the windows, they are all created and visibility is being toggled. So, the user clicks “Settings” and the settings window toggles visibility. I want to put a line in there that focuses the window to the front (so it isn’t behind the others) when it is made visible.
I have tried these:
ui.focusElement=nil
ui:SetFocusElement(masswindow, true)
masswindow:SetFocus(true)
masswindow:SetBringToFront(true)
to no avail. I must be missing something. I suppose I could destroy and recreate windows each time they were made visible, but that sounds really unnecessary.
What can I do for this? I even thought about faking the mouse click on the window…