My code currently instantiates a window, by default that window's visibility is set to hidden. When a button is pressed, the visibility is set to visible. When the window is already opened, and for example, behind the main window of the application, and a button is pressed to make it visible, the focus is still on the main window. How would one go about making it so it automatically grabs the focus of the sub window, and displays it in front of the main one instead of behind?
I'm not sure exactly how to go about this, or what to even search. Some direction would be great. I don't need code answers, just general suggestions.