TheHellTower Posted January 19, 2023 Share Posted January 19, 2023 Hello, I can't find out how to make my window top most, does anyone know how to make the window top most if a checkbox is selected ? Because the code see if it's selected or no but I can't find any element to make it top most. Regards. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 19, 2023 Share Posted January 19, 2023 I think Window::Activate() will select the window and bring it to the top. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
TheHellTower Posted January 19, 2023 Author Share Posted January 19, 2023 2 minutes ago, Josh said: I think Window::Activate() will select the window and bring it to the top. Well the problem is I don't want to bring it to the top with a loop but I want to make it top most until I uncheck the checkbox Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted January 19, 2023 Solution Share Posted January 19, 2023 Ah, okay. You can use GetHandle() and start using the Win32 API. This won't be cross-platform, but it will work on Windows: SetWindowPos(window->GetHandle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); https://stackoverflow.com/questions/14989062/set-a-window-to-be-topmost 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
TheHellTower Posted January 19, 2023 Author Share Posted January 19, 2023 9 minutes ago, Josh said: Ah, okay. You can use GetHandle() and start using the Win32 API. This won't be cross-platform, but it will work on Windows: SetWindowPos(window->GetHandle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); https://stackoverflow.com/questions/14989062/set-a-window-to-be-topmost Yeah at start I searched for a handle then I was thinking if it would work with UAK but yeah perfect then thanks ! Quote Link to comment Share on other sites More sharing options...
TheHellTower Posted January 19, 2023 Author Share Posted January 19, 2023 Final: if (THTtmcb->GetState() == WIDGETSTATE_SELECTED) { SetWindowPos(window->GetHandle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } else if(THTtmcb->GetState() == WIDGETSTATE_UNSELECTED) { SetWindowPos(window->GetHandle(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted January 19, 2023 Share Posted January 19, 2023 58 minutes ago, Josh said: Ah, okay. You can use GetHandle() and start using the Win32 API. This won't be cross-platform, but it will work on Windows: SetWindowPos(window->GetHandle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); https://stackoverflow.com/questions/14989062/set-a-window-to-be-topmost Hopefully there can be a window function that does this cross platform. This is useful to ensure a window is shown on top after a splash window. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
TheHellTower Posted January 19, 2023 Author Share Posted January 19, 2023 2 minutes ago, reepblue said: Hopefully there can be a window function that does this cross platform. This is useful to ensure a window is shown on top after a splash window. That would be nice yeah but then it would be better if you can pass a boolean to set it top most or no, but I personally prefer when splash are top most I don't think it's really important for software form itself. The "Vectronic" topic doesn't exist anymore in your signature ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.