Attempted to make property window always on top... ineffective

This commit is contained in:
andreja6
2019-11-05 22:51:27 -08:00
parent f9a1eea0d2
commit 01bc10f852
3 changed files with 18 additions and 3 deletions

View File

@@ -54,6 +54,16 @@ PartInstance* Application::makePart()
return part; return part;
} }
void Application::setFocus(bool focus)
{
if(focus)
{
MessageBox(NULL, "NO", "NO", MB_OK);
SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
else SetWindowPos(_propWindow->_hwndProp, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
Application::Application(HWND parentWindow) { //: GApp(settings,window) { Application::Application(HWND parentWindow) { //: GApp(settings,window) {
@@ -730,9 +740,9 @@ void Application::onMouseLeftPressed(HWND hwnd,int x,int y)
if(g_selectedInstances.at(i) == test) if(g_selectedInstances.at(i) == test)
{ {
found = true; found = true;
ShowWindow(_propWindow->_hwndProp, SW_SHOW); //ShowWindow(_propWindow->_hwndProp, SW_SHOW);
SetActiveWindow(_propWindow->_hwndProp); //SetActiveWindow(_propWindow->_hwndProp);
SetForegroundWindow(_propWindow->_hwndProp); //SetForegroundWindow(_propWindow->_hwndProp);
break; break;
} }
} }

View File

@@ -43,6 +43,7 @@ class Application { // : public GApp {
void onMouseRightUp(int x, int y); void onMouseRightUp(int x, int y);
void onMouseMoved(int x, int y); void onMouseMoved(int x, int y);
void onMouseWheel(int x, int y, short delta); void onMouseWheel(int x, int y, short delta);
void setFocus(bool isFocused);
int getMode(); int getMode();
CameraController cameraController; CameraController cameraController;
UserInput* userInput; UserInput* userInput;

View File

@@ -74,6 +74,10 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SIZE: case WM_SIZE:
app->resizeWithParent(hwnd); app->resizeWithParent(hwnd);
break; break;
case WM_ACTIVATEAPP:
if(wParam == FALSE) app->setFocus(false);
else app->setFocus(true);
break;
default: default:
{ {
return DefWindowProc(hwnd, msg, wParam, lParam); return DefWindowProc(hwnd, msg, wParam, lParam);